Skip to content

Fix Wikitext (Zim wiki) multiline code block rendering#2808

Open
Self-Perfection wants to merge 1 commit intogsantner:masterfrom
Self-Perfection:fix-wikitext-code-blocks
Open

Fix Wikitext (Zim wiki) multiline code block rendering#2808
Self-Perfection wants to merge 1 commit intogsantner:masterfrom
Self-Perfection:fix-wikitext-code-blocks

Conversation

@Self-Perfection
Copy link
Copy Markdown
Contributor

Extract {{{code: ...}}} (Zim Source View plugin) and '''...''' (Zim standard preformatted) blocks before the per-line transformation so their content is not mangled by inline rules like IMAGE ({{X}} -> image embed). Extracted blocks are wrapped in Markdown fenced code blocks and re-inserted after the per-line pass.

Fixes: multiline code blocks containing {{Variable}} tokens being rendered as broken images and live HTML.


Tested by running added code in Java, separately from Markor. Relying on CI/CD in your repo for building APK for full integration test.


I've seen request to do auto-reformat. But I do not have Android studio. And for me generated code looks OKish? I suppose Claude is good enough in following conventions and this does not need passing through external tools for proper formatting?

Extract `{{{code: ...}}}` (Zim Source View plugin) and `'''...'''`
(Zim standard preformatted) blocks before the per-line transformation
so their content is not mangled by inline rules like IMAGE
(`{{X}}` -> image embed). Extracted blocks are wrapped in Markdown
fenced code blocks and re-inserted after the per-line pass.

Fixes: multiline code blocks containing `{{Variable}}` tokens being
rendered as broken images and live HTML.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Self-Perfection
Copy link
Copy Markdown
Contributor Author

Self-Perfection commented Apr 24, 2026

Tested APK with this file

06_code_block_with_html.txt

Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.6
Creation-Date: 2026-04-24T14:00:00+01:00

====== 06 code block with html ======

{{{code: id="Front Template" lang="html" linenumbers="False"
<span class="marker">🔄</span>
<button class="marker" popovertarget="Notes popup">🗒</button>
<dialog popover id="Notes popup">Some notes</dialog>
}}}

Works as expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant