fix: stop over-escaping inline chars in markdown autoescape#119
Merged
Conversation
Trim `markdown_escape` to escape only inline-significant characters
(\, `, *, _, [, ], <) plus block-leading markers (#, >, -, +, ordered-list
digits) at line start. Hyphens, parens, hashes, and pipes mid-line now
render unmangled — release notes no longer show `2026\-04\-24` or
`divide\(1, 0\)`.
Add `__markdown__` to `Markup` so `{{ x | safe }}` opts out of escaping
in markdown mode the same way it does in HTML mode. Built-in release-notes
templates pipe PR `body_excerpt` and `body` through `| safe` so PR-body
markdown (`## Summary`, bullet lists, inline code) renders as authored
instead of as backslash-escaped literals inside `<details>` blocks.
Snapshots refreshed across 14 templates; all 4202 tests pass.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The v0.8.0 release notes shipped with mangled output (
2026\-04\-24,feat\-UX,\#\# Summaryinside every<details>block) because Kida'sautoescape="markdown"was backslash-escaping 16 characters on every interpolated value — including hyphens, parens, hashes, and pipes that don't actually need escaping inline.Changes
markdown_escapetrimmed to inline-only chars (\,`,*,_,[,],<) plus block-leading markers (#,>,-,+, ordered-list digits) escaped only at line start, matching CommonMark/GFM parsing.Markup.__markdown__()added so{{ x | safe }}opts out of escaping in markdown mode the same way it does in HTML mode (previously a no-op under markdown autoescape).body_excerptandbodythrough| safeso PR-body markdown renders as authored.[Unreleased]changelog entry added with breaking-change note per the project's release style.Test plan
uv run pytest— 4202 passed, 5 skippeduv run ruff check/format— clean## Summaryheadings inside<details>blocks now render cleanly🤖 Generated with Claude Code