2023-03-09 12:18:50 -05: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.
|
|
|
|
|
2023-05-15 05:28:55 -05:00
|
|
|
python3 -m venv venv
|
|
|
|
./venv/bin/pip3 install -r requirements.txt
|
2023-03-09 12:18:50 -05:00
|
|
|
|
|
|
|
Add to Gitea app.ini.
|
|
|
|
|
|
|
|
[markup.restructuredtext]
|
|
|
|
ENABLED = true
|
|
|
|
FILE_EXTENSIONS = .rst
|
2023-05-15 05:28:55 -05:00
|
|
|
RENDER_COMMAND = timeout 30s sudo -u sphinx ./custom/sphinx/venv/bin/python3 ./custom/sphinx/sphinx_to_html.py
|
2023-03-09 12:18:50 -05:00
|
|
|
|
2023-03-13 18:58:31 -05:00
|
|
|
[markup.sanitizer.restructuredtext]
|
|
|
|
ELEMENT = div
|
|
|
|
ALLOW_ATTR = class
|
|
|
|
REGEXP = ^(restructuredtext)$
|
|
|
|
|
2023-03-09 12:18:50 -05:00
|
|
|
[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
|
2023-05-09 09:45:35 -05:00
|
|
|
assume to be so secure that it should have access to all gitea data. This user
|
|
|
|
needs read-only access to the custom/sphinx, and the user running gitea needs
|
|
|
|
to be able to run a process as the `sphinx` user.
|