madskristensen / MarkdownEditor

A Visual Studio extension
Other
409 stars 93 forks source link

Inline code within heading generates unexpected HTML if it contains matching braces #231

Open russplaysguitar opened 2 years ago

russplaysguitar commented 2 years ago

Description

The HTML generated by MarkdownEditor 1.12.253 when using inline code containing matching braces within a heading is not the same as the Markdig HTML output and appears to be incorrect in general.

Steps to reproduce

  1. Create an .md file in Visual Studio that has a heading with inline code that contains matching braces. For example:
    ### `GET /foo/bar/{baz}`
  2. Open the HTML file generated by MarkdownEditor

Expected behavior: HTML should be like:

<h3>
  <code>
    GET /foo/bar/{baz}
  </code>
</h3>

Actual behavior: HTML is like:

<h3 id="get-foobar" baz>`GET /foo/bar/</h3>

Notice baz has been moved into the heading tag.

Observations: This occurs for all heading levels (1 through 5). Compare with Markdig output here: https://babelmark.github.io/?text=%23%23%23+%60GET+%2Ffoo%2Fbar%2F%7Bbaz%7D%60. I tried a few ideas but was unable to determine a workaround.

russplaysguitar commented 2 years ago

On closer review of the Markdig output, I noticed that the output of "markdig (advanced) 0.26.0.0C#" does have the same error.