0
Fork 0
mirror of https://projects.blender.org/infrastructure/gitea-custom.git synced 2024-12-22 07:13:09 -05:00
blender-projects-gitea-custom/sphinx
2023-04-24 13:09:18 +02:00
..
template Add renderer for Sphinx .rst files, for user manual previews 2023-04-24 13:09:18 +02:00
README.md Fix issues with links, includes and notes in Sphinx .rst preview styling 2023-04-24 13:09:18 +02:00
requirements.txt Add renderer for Sphinx .rst files, for user manual previews 2023-04-24 13:09:18 +02:00
sphinx_to_html.py Fix issues with links, includes and notes in Sphinx .rst preview styling 2023-04-24 13:09:18 +02:00

Sphinx RST to HTML Preview

Command for generating previews of RST files on projects.blender.org.

The template is adapted from the Blender manual to support the same extensions.

Deployment

Install dependencies.

pip3 install -r requirements.txt

Add to Gitea app.ini.

[markup.restructuredtext]
ENABLED = true
FILE_EXTENSIONS = .rst
RENDER_COMMAND = "timeout 30s ./custom/sphinx/sphinx_to_html.py --user sphinx --user-work-dir /path/to/dir"
IS_INPUT_FILE = true

[markup.sanitizer.restructuredtext]
ELEMENT = div
ALLOW_ATTR = class
REGEXP = ^(restructuredtext)$

[repository.editor]
LINE_WRAP_EXTENSIONS = .txt,.md,.markdown,.mdown,.mkd,.rst
PREVIEWABLE_FILE_MODES = markdown,restructuredtext

The sphinx user is required for sandboxing of sphinx-build which we do not assume to be secure. The work directory should be writable by both the gitea user and sphinx user, with the sphinx user having as little access as possible to other directories.