Skip to content

Commit d7e669c

Browse files
authored
Update Asciidoc markup example with safe defaults (#24920)
The cheat sheet uses the `asciidoc` markup language to demonstrate how to set up third party markup renderers. The current example has the following issues: - It promotes a legacy tool that does not handle modern AsciiDoc specifications - It does not account for embedded preview renders - It has no safety restrictions By switching to `asciidoctor`, uses are suggested to utilize de facto/standard tooling for AsciiDoc. The `--embedded` parameter will strip out HTML tags that contain the document (such as `<html></html>`) which aren't necessary for the render, and actually end up as text in the document if left in. The `--safe-mode` parameter (of which there are several profiles) imposes [certain policies](https://docs.asciidoctor.org/asciidoctor/latest/safe-modes/) on the files it ingests and what the resulting output looks like. GitHub itself uses the `secure` profile (the highest), which can be a good starting point for those who are uncertain of what to do. By default, if no mode is specified when `asciidoctor` runs it defaults to `unsafe`, i.e. no safety guidelines at all.
1 parent 69e73fd commit d7e669c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/content/doc/administration/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ Gitea can support Markup using external tools. The example below will add a mark
11181118
ENABLED = true
11191119
NEED_POSTPROCESS = true
11201120
FILE_EXTENSIONS = .adoc,.asciidoc
1121-
RENDER_COMMAND = "asciidoc --out-file=- -"
1121+
RENDER_COMMAND = "asciidoctor --embedded --safe-mode=secure --out-file=- -"
11221122
IS_INPUT_FILE = false
11231123
```
11241124

docs/content/doc/administration/config-cheat-sheet.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ test01.xls: application/vnd.ms-excel; charset=binary
337337
ENABLED = false
338338
NEED_POSTPROCESS = true
339339
FILE_EXTENSIONS = .adoc,.asciidoc
340-
RENDER_COMMAND = "asciidoc --out-file=- -"
340+
RENDER_COMMAND = "asciidoctor --embedded --safe-mode=secure --out-file=- -"
341341
IS_INPUT_FILE = false
342342
```
343343

0 commit comments

Comments
 (0)