]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
fix: add remark plugin to render raw HTML as literal text (#16505)
authorPascal <redacted>
Mon, 13 Oct 2025 08:55:32 +0000 (10:55 +0200)
committerGitHub <redacted>
Mon, 13 Oct 2025 08:55:32 +0000 (10:55 +0200)
commit1fb9504eb744969a990bfe4cfcf1d3d7a479541c
tree89be6129790a302fe025c3c0b129487d589b1388
parent3f750f8d760ab5a61491e6a9409072dfeee4b4d7
fix: add remark plugin to render raw HTML as literal text (#16505)

* fix: add remark plugin to render raw HTML as literal text

Implemented a missing MDAST stage to neutralize raw HTML like major LLM WebUIs
do ensuring consistent and safe Markdown rendering

Introduced 'remarkLiteralHtml', a plugin that converts raw HTML nodes in the
Markdown AST into plain-text equivalents while preserving indentation and
line breaks. This ensures consistent rendering and prevents unintended HTML
execution, without altering valid Markdown structure

Kept 'remarkRehype' in the pipeline since it performs the required conversion
from MDAST to HAST for KaTeX, syntax highlighting, and HTML serialization

Refined the link-enhancement logic to skip unnecessary DOM rewrites,
fixing a subtle bug where extra paragraphs were injected after the first
line due to full innerHTML reconstruction, and ensuring links open in new
tabs only when required

Final pipeline: remarkGfm -> remarkMath -> remarkBreaks -> remarkLiteralHtml
-> remarkRehype -> rehypeKatex -> rehypeHighlight -> rehypeStringify

* fix: address review feedback from allozaur

* chore: update webui build output
tools/server/public/index.html.gz
tools/server/webui/package-lock.json
tools/server/webui/package.json
tools/server/webui/src/lib/components/app/misc/MarkdownContent.svelte
tools/server/webui/src/lib/constants/literal-html.ts [new file with mode: 0644]
tools/server/webui/src/lib/markdown/literal-html.ts [new file with mode: 0644]