25 Commits

Author SHA1 Message Date
Manuel Rüger
17436efd17 renderer: HTML-escape admonition title and guard against empty attachments
mkDocsAdmonition: escape the admonition title with html.EscapeString
before inserting it into the Confluence storage format XML. An unescaped
title containing '<', '>', '&', or '"' would break the XML structure.

image: add a len(attachments)==0 guard before accessing attachments[0]
in the local-attachment code path. ResolveLocalAttachments always returns
either an error or the requested attachments, so this is currently
unreachable, but the explicit check prevents a future silent panic if the
function's behaviour changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-16 19:18:29 +01:00
Manuel Rüger
0d735203dd fix: trim whitespace from ParseTitle result
ParseTitle returned lang[start:] without trimming, so inputs like
'python title  My Title' returned '  My Title' with leading spaces.
The extra whitespace propagated into the rendered Confluence title
element. Add strings.TrimSpace to remove leading/trailing whitespace.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-16 19:18:29 +01:00
Manuel Rüger
cf0699c088 fix: remove dead level-map infrastructure in mkDocsAdmonitionRenderer
GenerateMkDocsAdmonitionLevel walked the AST looking for
ast.KindBlockquote nodes to build a nesting-level map, but the
renderer is registered for parser.KindAdmonition nodes. Because
admonition nodes were never added to the map, LevelMap.Level()
always returned 0 for every admonition, making the level check
in renderMkDocsAdmonition a no-op.

The intended behaviour (all admonitions rendered as Confluence
structured macros regardless of nesting) was accidentally working
because of this bug. Remove the dead MkDocsAdmonitionLevelMap type,
GenerateMkDocsAdmonitionLevel function, and LevelMap field, and
simplify renderMkDocsAdmonition to directly render the Confluence
macro for all known admonition types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-16 19:18:29 +01:00
Manuel Rüger
594c1e4fa0 fix: guard FirstChild() nil in paragraph renderer
A paragraph node with no children causes FirstChild() to return nil,
making both the entering and leaving Kind() checks panic. Cache the
result once and treat nil the same as a non-RawHTML child (emit <p>).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-16 19:18:29 +01:00
Johan Fagerberg
ab2c456851 chore: fix comment referring to wrong class 2026-03-11 12:49:22 +01:00
Johan Fagerberg
8e613c5e70 style: run gofmt on image_test.go 2026-03-11 12:49:22 +01:00
Johan Fagerberg
6f18a47ed0 feat: don't add redundant 'height' to images 2026-03-11 12:49:22 +01:00
Johan Fagerberg
a0e9594f50 chore: clean up over-explanations slightly 2026-03-11 12:49:22 +01:00
Johan Fagerberg
9c58c36b46 feat: use 'center' for image widths 760<x<1800 2026-03-11 12:49:22 +01:00
Johan Fagerberg
cbc7400f92 feat: align image rendering with Confluence default 2026-03-11 12:49:22 +01:00
Johan Fagerberg
4d887bde74 feat: add support for image dimensions 2026-03-11 12:49:22 +01:00
Johan Fagerberg
c32cd79dc8 feat: add support for '--image-align' 2026-03-11 12:49:22 +01:00
Manuel Rüger
d2717f031d Add Confluence task list renderer for GFM task lists
Convert GFM task list items (- [x] / - [ ]) to Confluence
ac:task-list XML format instead of HTML checkboxes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-09 23:37:36 +01:00
Manuel Rüger
e294a7317e Move mention macro into a goldmark-parser/renderer 2026-02-08 00:59:43 +01:00
hypengw
c1c9a13391 parse "linenumbers" in code block 2026-01-15 12:18:28 +01:00
Manuel Rüger
888d5de655 fix: Panic on empty link 2025-11-28 14:35:32 +01:00
Manuel Rüger
a7390d8b33 Use strconv.Unqoute 2025-11-28 14:21:04 +01:00
Aldo Mateli
0583aaa7ce Strip double quotes from admonition titles 2025-11-28 14:21:04 +01:00
Manuel Rüger
5e2b7b64e8 Drop cloudscript support for mermaid 2025-08-13 14:04:18 +02:00
Paul.Glesmann
32490b2c90 feat: add Support for converting Material for MkDocs Admonitions to Confluence Info Panels
chore: add test files

fix: add tests for stripnewline and droph1

chore: rename Admontion to MkDocsAdmonition, remove annoying comments

fix: import parser instead of copying the file

chore: rename mkDocs renderer function

fix: fix bug and pipeline

feat: add Support for converting Material for MkDocs Admonitions to Confluence Info Panels

fix: add tests for stripnewline and droph1

chore: rename Admontion to MkDocsAdmonition, remove annoying comments

fix: import parser instead of copying the file

chore: rename mkDocs renderer function

fix: fix bug and pipeline

chore: remove test for droph1 and stripNewLines

fix: add admonitions to StripNewLines and dropH1 tests

feat: add Support for converting Material for MkDocs Admonitions to Confluence Info Panels

fix: add tests for stripnewline and droph1

chore: rename Admontion to MkDocsAdmonition, remove annoying comments

fix: import parser instead of copying the file

chore: rename mkDocs renderer function

fix: fix bug and pipeline

feat: add Support for converting Material for MkDocs Admonitions to Confluence Info Panels

chore: rename Admontion to MkDocsAdmonition, remove annoying comments

fix: import parser instead of copying the file

chore: rename mkDocs renderer function

fix: fix bug and pipeline

chore: remove test for droph1 and stripNewLines

fix: add admonitions to StripNewLines and dropH1 tests

feat: add mkdocsadmonition as opt-in renderer and parser

fix: fix unit tests
2025-06-18 11:14:52 +02:00
Manuel Rüger
3cc39ffe79 Add support for d2lang 2025-05-30 23:37:15 +02:00
Manuel Rüger
f24d8c8957 Fix lint issues detected by golangci v2 2025-04-02 16:42:32 +02:00
Manuel Rüger
e7a3877ded Bump goldmark to 1.7.8 2024-10-21 14:39:40 +02:00
Manuel Rüger
33e5d1ff19 blockquote: Fix invalid access 2024-10-06 00:10:46 +02:00
Manuel Rüger
dc8842106b *: Reorganize code 2024-09-29 00:13:04 +02:00