Repository navigation
Stop over-escaping text in the Markdown sink - #1070
Merged
slachiewicz merged 2 commits intoAug 8, 2026
Merged
Conversation
Three cases where the sink escaped characters that are not special in Markdown, making generated documents noisy and hard to hand-edit: - " and ' were turned into " and '. Markdown is not XML; both are ordinary characters there. Only <, > and & still get escaped, so text is never mistaken for raw HTML. - ( and ) were escaped everywhere. They are only special inside a link destination, and destinations are written without going through the text escaping, so 'JDK (i.e. Java 6)' no longer becomes 'JDK \(i.e. Java 6\)'. - . was escaped after any digit, so a version such as 1.6 came out as 1\.6. It only needs escaping when it would turn leading digits into an ordered list marker, i.e. when only whitespace and digits precede it. Adjusted the one affected expectation in MarkdownSinkTest.
A space ends the destination of a Markdown inline link and starts the
optional title, so a destination carrying one does not resolve. APT allows
spaces in both anchors and URLs, so converting a document like
The {{{#Identity Mapper}Identity Mapper}}
produced [Identity Mapper](#Identity Mapper), which links nowhere.
An in-page anchor now gets the same encoding an anchor definition receives,
which is also what the HTML renderer applies to the anchor it points at, and
any other destination has its spaces percent-encoded.
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.
Three cases where the sink escaped characters that are not special in
Markdown, making generated documents noisy and hard to hand-edit:
are ordinary characters there. Only <, > and & still get escaped, so
text is never mistaken for raw HTML.
destination, and destinations are written without going through the
text escaping, so 'JDK (i.e. Java 6)' no longer becomes 'JDK (i.e.
Java 6)'.
1.6. It only needs escaping when it would turn leading digits into an
ordered list marker, i.e. when only whitespace and digits precede it.
Adjusted the one affected expectation in MarkdownSinkTest.
A second change in the same area: a space ends the destination of a Markdown
inline link and starts the optional title, so a destination carrying one does
not resolve. APT allows spaces in both anchors and URLs, so converting a
document like
produced [Identity Mapper](#Identity Mapper), which links nowhere. An in-page
anchor now gets the same encoding an anchor definition receives, which is also
what the HTML renderer applies to the anchor it points at, and any other
destination has its spaces percent-encoded.
Part of the wider migration tracked in
apache/maven-doxia-converter#139