fsprojects / FSharp.Formatting

F# tools for generating documentation (Markdown processor and F# code formatter)
https://fsprojects.github.io/FSharp.Formatting/
Other
462 stars 155 forks source link

Get CommonMark 0.30 tests to pass for "Fenced code blocks" section #822

Open DavidSSL opened 1 year ago

DavidSSL commented 1 year ago

This is very similar to #821 and also originates from #90.

When using the CommonMark version 0.30 test cases, the following battery of tests

https://github.com/fsprojects/FSharp.Formatting/blob/09491d141cb3d1bacb1c4b307a924014c90e8428/tests/FSharp.Markdown.Tests/CommonMarkSpecTest.fs#L47-L52

, experience the problem that some of the tests start failing.

The aim would be to ensure that the tests falling under the Fenced code blocks section to pass.

One of the tests is failing as:

Expected string length 26 but was 25. Strings differ at index 9.
Expected: "<p><code> </code>\naaa</p>\n"
But was:  "<p><code></code>\naaa</p>\n"

and this is caused by toCharArray here:

https://github.com/fsprojects/FSharp.Formatting/blob/09491d141cb3d1bacb1c4b307a924014c90e8428/src/FSharp.Formatting.Markdown/MarkdownParser.fs#L524-L527

which is "trimming" the whitespace character.