Package
markdown-confluence-sync
What happened?
Description
When a GitHub alert callout (e.g. > [!NOTE]) contains inline formatting (**bold**, *italic*, links, etc.) on the line right after the alert marker, the trailing whitespace before the inline element is stripped at render time. The result in Confluence is text glued to the next inline element (e.g. text**bold** rendered as text<strong>bold</strong> without the separating space).
Reproduction
Markdown source:
> [!NOTE]
> This is a callout with **bold text** inside.
After sync, the Confluence page renders this as:
This is a callout withbold text inside.
(no space between "with" and the bold word)
Expected behavior
The space between the previous word and the inline element should be preserved. The render should be:
This is a callout with bold text inside.
Actual behavior
The leading text node inside the callout is .trim()-ed, removing the trailing space that should sit between the text and the next inline element.
Cause
In components/markdown-confluence-sync/src/lib/confluence/transformer/support/rehype/rehype-replace-github-alerts.ts:
const remainingText = text.substring(alertMatch[0].length).trim();
.trim() strips both leading AND trailing whitespace. It should only strip the leading whitespace (which separates the alert marker from the actual content), not the trailing one (which separates the text from the next sibling element).
Suggested fix
Replace .trim() with a leading-only trim:
const remainingText = text.substring(alertMatch[0].length).replace(/^\s+/, '');
Workaround
Insert a blank > line between the alert marker and the content:
> [!NOTE]
>
> This is a callout with **bold text** inside.
This produces two paragraphs in the blockquote — the first one only containing the alert marker (which gets safely trimmed), the second one preserving the inline formatting untouched.
Environment
@telefonica/markdown-confluence-sync v2.4.0
- Node 20+
- Mode: tree
Version
2.x
Relevant log output
Code of Conduct
Package
markdown-confluence-sync
What happened?
Description
When a GitHub alert callout (e.g.
> [!NOTE]) contains inline formatting (**bold**,*italic*, links, etc.) on the line right after the alert marker, the trailing whitespace before the inline element is stripped at render time. The result in Confluence is text glued to the next inline element (e.g.text**bold**rendered astext<strong>bold</strong>without the separating space).Reproduction
Markdown source:
After sync, the Confluence page renders this as:
(no space between "with" and the bold word)
Expected behavior
The space between the previous word and the inline element should be preserved. The render should be:
Actual behavior
The leading text node inside the callout is
.trim()-ed, removing the trailing space that should sit between the text and the next inline element.Cause
In
components/markdown-confluence-sync/src/lib/confluence/transformer/support/rehype/rehype-replace-github-alerts.ts:.trim()strips both leading AND trailing whitespace. It should only strip the leading whitespace (which separates the alert marker from the actual content), not the trailing one (which separates the text from the next sibling element).Suggested fix
Replace
.trim()with a leading-only trim:Workaround
Insert a blank
>line between the alert marker and the content:This produces two paragraphs in the blockquote — the first one only containing the alert marker (which gets safely trimmed), the second one preserving the inline formatting untouched.
Environment
@telefonica/markdown-confluence-syncv2.4.0Version
2.x
Relevant log output
Code of Conduct