Skip to content

fix: drop alt text from Jira wiki image markup - #6

Merged
rethab merged 2 commits into
mainfrom
fix/issue-568
Jul 12, 2026
Merged

fix: drop alt text from Jira wiki image markup#6
rethab merged 2 commits into
mainfrom
fix/issue-568

Conversation

@rethab

@rethab rethab commented Jul 12, 2026

Copy link
Copy Markdown
Owner

ToJiraMD currently renders `description` as `!https://google.comdescription!\`, which is invalid Jira wiki image syntax. The vendored blackfriday-confluence renderer writes the opening and closing `!` markers for an image node but never suppresses the node's children, so the alt text gets written into the default text stream between the two markers.

Jira wiki image markup (`!url!`) has no place for alt text at all, so the fix walks the markdown AST directly in `pkg/md/md.go` instead of calling `renderer.Render` as-is: for image nodes it writes `!` + destination + `!` and returns `bf.SkipChildren` to drop the alt text subtree, delegating every other node type to the existing `renderer.RenderNode`. The existing no-alt-text image case (`` -> `!url!`) is unaffected, and a new case for `description` was added to the test to lock in the fix.

Addresses ankitpokhrel#568.

ToJiraMD rendered `![alt](url)` as `!urlalt!`, concatenating the
destination and alt text inside the same `!...!` markers because the
vendored blackfriday-confluence renderer writes the opening/closing
markers but still lets the Image node's children (the alt text) fall
through to default text rendering in between. Jira wiki image syntax
has no slot for alt text, so we now walk the AST ourselves, write the
`!url!` markers directly for Image nodes, and skip their children
while delegating every other node to the existing renderer.
Writing the image markers straight to the buffer bypassed the renderer,
whose internal state decides whether the next block needs a leading
newline. That left it stale, so a table or list following an image was
glued onto the preceding line and did not render in Jira.
@rethab
rethab merged commit a47ffd3 into main Jul 12, 2026
8 checks passed
@rethab
rethab deleted the fix/issue-568 branch July 12, 2026 13:43
rethab added a commit that referenced this pull request Aug 5, 2026
ToJiraMD currently renders \`![description](https://google.com)\` as
\`!https://google.comdescription!\`, which is invalid Jira wiki image
syntax. The vendored blackfriday-confluence renderer writes the opening
and closing \`!\` markers for an image node but never suppresses the
node's children, so the alt text gets written into the default text
stream between the two markers.

Jira wiki image markup (\`!url!\`) has no place for alt text at all, so
the fix walks the markdown AST directly in \`pkg/md/md.go\` instead of
calling \`renderer.Render\` as-is: for image nodes it writes \`!\` +
destination + \`!\` and returns \`bf.SkipChildren\` to drop the alt text
subtree, delegating every other node type to the existing
\`renderer.RenderNode\`. The existing no-alt-text image case
(\`![](url)\` -> \`!url!\`) is unaffected, and a new case for
\`![description](url)\` was added to the test to lock in the fix.

Addresses ankitpokhrel#568.
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