Skip to content

Commit

Permalink
placate lint
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath committed Sep 3, 2022
1 parent ca3573d commit 810c790
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/content/doc/advanced/external-renderers.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ RENDER_COMMAND = "timeout 30s pandoc +RTS -M512M -RTS -f rst"
IS_INPUT_FILE = false
```

If your external markup relies on additional classes and attributes on the generated HTML elements, you might need to enable custom sanitizer policies. Gitea uses the [`bluemonday`](https://godoc.org/github.com/microcosm-cc/bluemonday) package as our HTML sanitizier. The example below will support [KaTeX](https://katex.org/) output from [`pandoc`](https://pandoc.org/).
If your external markup relies on additional classes and attributes on the generated HTML elements, you might need to enable custom sanitizer policies. Gitea uses the [`bluemonday`](https://godoc.org/github.com/microcosm-cc/bluemonday) package as our HTML sanitizier. The example below could be used to support server-side [KaTeX](https://katex.org/) rendering output from [`pandoc`](https://pandoc.org/).

```ini
[markup.sanitizer.TeX]
; Pandoc renders TeX segments as <span>s with the "math" class, optionally
; with "inline" or "display" classes depending on context.
; - note this is different from the built-in math support in our markdown parser which uses <code>
ELEMENT = span
ALLOW_ATTR = class
REGEXP = ^\s*((math(\s+|$)|inline(\s+|$)|display(\s+|$)))+
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/markup/content.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {renderMermaid} from './mermaid.js';
import {renderMath} from './katex.js';
import {renderMath} from './math.js';
import {renderCodeCopy} from './codecopy.js';
import {initMarkupTasklist} from './tasklist.js';

Expand Down
2 changes: 1 addition & 1 deletion web_src/js/markup/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function renderMath() {

try {
const markup = katex.renderToString(source, options);
const target = document.createElement(options.display ? 'p' : 'span')
const target = document.createElement(options.display ? 'p' : 'span');
target.innerHTML = markup;
if (el.classList.contains('is-loading')) {
el.replaceWith(target);
Expand Down

0 comments on commit 810c790

Please sign in to comment.