Skip to content

Renderer counts non-ASCII punctuation as flanking, unlike the parser #93

Description

@morisil

Follow-up from the second review of #92 (branch simplify-html-native-emphasis).

isMarkdownPunctuation in MarkdownRendering.kt (used by closePendingInline) treats every Unicode punctuation and symbol char as punctuation. The parser's flanking check (isFlankPunct in MarkanywhereParser.kt) only counts ASCII punctuation. So when a closer ends in ASCII punctuation and is followed by a non-ASCII punctuation char, the renderer decides the closer is right-flanking and doesn't encode the next char. The parser disagrees.

Repro

  • <strong>Price:</strong>€5 renders **Price:**€5, which re-parses as **Price:\*\*€5**.
  • <strong>Note:</strong>“x” has the same problem.

Fix

Use the parser's ASCII rule in closePendingInline: skip the &#…; encoding only for whitespace or ASCII punctuation. Add a MarkdownRenderingTest case and an EmphasisDelimiterRoundTripTest fixpoint case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions