Skip to content

Use a dedicated pipeline for changelog-generated markdown - #4231

Merged
akira28 merged 3 commits into
mainfrom
fix/build
Sep 28, 2026
Merged

akira28 merged 3 commits into
mainfrom
fix/build

Conversation

@akira28

@akira28 akira28 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Changelog markdown is generated from GitHub PR/issue titles and descriptions and re-parsed before rendering. Running that generated content through the full docs-builder pipeline causes substitution keys, MyST roles, and the diagnostic link validator to fire on text that was never intended to carry any of that syntax — the {{hostname}} CI failure is the direct example.

Affects: Release notes, Authoring

Prompt summary: The "build assembled documentation" CI job fails because a changelog entry title contains {{hostname}}, which the substitution parser treats as an undefined key. The fix should prevent docs-specific parsers from running on generated changelog content.

Why

DirectiveHtmlRenderer re-parses the output of ChangelogInlineRenderer using the full Pipeline. That pipeline includes UseSubstitution, all MyST role parsers, and UseDiagnosticLinks. Changelog content originates from GitHub PR/issue titles — it is not docs-builder source and none of those parsers should apply to it. Any {{key}} in a PR title triggers an Error diagnostic attributed to the wrong file and column, which then crashes Errata's source renderer.

What

ChangelogPipeline in MarkdownParser

A new public static ChangelogPipeline property strips every docs-specific extension: no substitution parser, no role parsers, no diagnostic link validator. It keeps the structural elements the changelog renderer actually uses — headings, lists, emphasis, autolinks, pipe tables, directives (for ::::dropdown blocks), and DisableHtml so raw HTML in descriptions cannot bleed through.

DirectiveHtmlRenderer uses ChangelogPipeline

The parse and render calls for changelog blocks now pass ChangelogPipeline instead of Pipeline. No other call site is affected.

Regression test

ChangelogDoubleBraceEscapeTests creates a bundle entry whose title contains {{hostname}} and asserts zero errors and the literal text in the HTML output.

Verify

./build.sh unit-test
# ChangelogDoubleBraceEscapeTests.RendersWithoutErrors
# ChangelogDoubleBraceEscapeTests.RendersTitleWithLiteralBraces

🤖 Generated with Claude Code

…n errors

A changelog entry whose title or description contains `{{hostname}}`
(or any double-brace template placeholder) triggers the substitution
parser when `ParseMarkdownStringAsync` re-parses the generated markdown.
Because the parser can't resolve the key, it emits an Error diagnostic.
That diagnostic's column is computed from the generated string, not from
the source file (`docs/release-notes.md`), so Errata crashes trying to
render a source label past the end of the line.

`RenderChangelogMarkdown` now replaces `{{` with `{{` before
returning. The HTML entity is invisible to the substitution parser
(which opens only on `{`), passes through Markdig as literal text, and
the browser decodes it back to `{{`. The visual output is unchanged.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@akira28
akira28 requested a review from a team as a code owner September 28, 2026 08:57
@akira28 akira28 added the bug label Sep 28, 2026
@akira28
akira28 requested a review from Mpdreamz September 28, 2026 08:57
@github-actions

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes due to a medium-severity rendering regression noted inline.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

// Escape {{ so it isn't re-processed as a substitution key when ParseMarkdownStringAsync
// re-parses this generated markdown. Changelog entry text (titles, descriptions) may
// contain template-placeholder syntax such as {{hostname}} that should render literally.
return sb.ToString().Replace("{{", "&#123;&#123;");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Global {{ escaping changes code-span output

Replacing {{ across the entire generated markdown string also affects inline/fenced code content from changelog entries. For example, a title containing `{{hostname}}` is rewritten to `{{hostname}}` before markdown parsing; in code spans, entities are rendered literally, so output becomes {{hostname}} instead of {{hostname}}.

This fixes substitution parsing, but introduces a rendering regression for valid changelog content that uses code formatting.

Please scope escaping so it bypasses code spans/fences (or escape at field level with markdown-aware handling), and add a regression test for {{...}} inside inline code.

Changelog markdown is generated from GitHub PR/issue titles and
descriptions, not authored in docs-builder source files. Running it
through the full docs-builder pipeline causes substitution keys, MyST
roles, and the diagnostic link validator to fire on content that was
never intended to carry any of that syntax — the {{hostname}} build
failure is the direct example.

A dedicated ChangelogPipeline strips all docs-specific parsers:
no UseSubstitution, no role parsers, no UseDiagnosticLinks. It keeps
the structural elements the renderer actually uses (headings, lists,
emphasis, autolinks, pipe tables, directives for dropdowns) and calls
DisableHtml so raw HTML in descriptions does not bleed into the output.

The earlier {{}} → &#123; escape workaround in RenderChangelogMarkdown
is removed — it is no longer needed.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@akira28 akira28 changed the title Escape {{...}} in changelog markdown to prevent substitution errors Use a dedicated pipeline for changelog-generated markdown Sep 28, 2026
.UseEmphasisExtras(EmphasisExtraOptions.Default)
.UsePipeTables()
.UseTaskLists()
.UseDirectives()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove this one, I don't think anyone will use actual directives in issue descriptions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is actually used for :::dropdown and maybe more stuff

@akira28
akira28 enabled auto-merge (squash) September 28, 2026 10:01

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: the new changelog-specific pipeline introduces a regression where %-commented hidden links are no longer stripped during changelog re-parse.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • d31bhlox0wglh.cloudfront.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "d31bhlox0wglh.cloudfront.net"

See Network Configuration for more information.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

.UseEmphasisExtras(EmphasisExtraOptions.Default)
.UsePipeTables()
.UseTaskLists()
.UseDirectives()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Changelog pipeline now renders %-prefixed hidden links

ChangelogPipeline is used to re-parse changelog markdown, but unlike Pipeline it does not include UseComments(). Changelog rendering relies on % ... comment lines to hide private/suppressed PR and issue links (for example from FormatPrLink(..., hidePrivateLinks: true)), so those lines are no longer stripped and can render as visible links/text in the final HTML.

This is a behavior regression introduced by this change and can expose links that were intentionally hidden. Please add .UseComments() to ChangelogPipeline (or stop emitting % sentinels before markdown parse).

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new findings in the latest revision.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

@akira28
akira28 merged commit feffe73 into main Sep 28, 2026
35 checks passed
@akira28
akira28 deleted the fix/build branch September 28, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants