Skip to content

Commit 49d9900

Browse files
juanpablo-santostechknowlogick
authored andcommitted
[website] file rendering through external binaries (#5387)
* #3758: [doc] file rendering through external binaries * fix subsections markup * include proposed changes from PR review
1 parent 6467934 commit 49d9900

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
date: "2018-11-23:00:00+02:00"
3+
title: "External renderers"
4+
slug: "external-renderers"
5+
weight: 40
6+
toc: true
7+
draft: false
8+
menu:
9+
sidebar:
10+
parent: "advanced"
11+
name: "External renderers"
12+
weight: 40
13+
identifier: "external-renderers"
14+
---
15+
16+
# Custom files rendering configuration
17+
18+
Gitea supports custom file renderings (i.e., Jupyter notebooks, asciidoc, etc.) through external binaries,
19+
it is just matter of:
20+
* installing external binaries
21+
* add some configuration to your `app.ini` file
22+
* restart your gitea instance
23+
24+
## Installing external binaries
25+
26+
In order to get file rendering through external binaries, their associated packages must be installed.
27+
If you're using a Docker image, your `Dockerfile` should contain something along this lines:
28+
29+
```
30+
FROM gitea/gitea:1.6.0
31+
[...]
32+
33+
COPY custom/app.ini /data/gitea/conf/app.ini
34+
[...]
35+
36+
RUN apk --no-cache add asciidoctor freetype freetype-dev gcc g++ libpng python-dev py-pip python3-dev py3-pip
37+
# install any other package you need for your external renderers
38+
39+
RUN pip3 install --upgrade pip
40+
RUN pip3 install -U setuptools
41+
RUN pip3 install jupyter matplotlib docutils
42+
# add above any other python package you may need to install
43+
```
44+
45+
## `app.ini` file configuration
46+
47+
add one `[markup.XXXXX]` section per external renderer on your custom `app.ini`:
48+
49+
```
50+
[markup.asciidoc]
51+
ENABLED = true
52+
FILE_EXTENSIONS = .adoc,.asciidoc
53+
RENDER_COMMAND = "asciidoctor --out-file=- -"
54+
; Input is not a standard input but a file
55+
IS_INPUT_FILE = false
56+
57+
[markup.jupyter]
58+
ENABLED = true
59+
FILE_EXTENSIONS = .ipynb
60+
RENDER_COMMAND = "jupyter nbconvert --stdout --to html --template basic "
61+
IS_INPUT_FILE = true
62+
63+
[markup.restructuredtext]
64+
ENABLED = true
65+
FILE_EXTENSIONS = .rst
66+
RENDER_COMMAND = rst2html.py
67+
IS_INPUT_FILE = false
68+
```
69+
70+
Once your configuration changes have been made, restart Gitea to have changes take effect.

0 commit comments

Comments
 (0)