cmarkit icon indicating copy to clipboard operation
cmarkit copied to clipboard

CommonMark renderer doesn't escape tilde before strikethrough

Open tysg opened this issue 1 year ago • 1 comments

Thank you for this great library.

utop # Cmarkit.Doc.of_string ~strict:false {|\~~~strike~~|} |> print_doc;;
Paragraph:
  Inlines:
    Text: '~'
    Strikethrough:
      Text: 'strike'

- : unit = ()
utop # Cmarkit.Doc.of_string ~strict:false {|\~~~strike~~|} |> Cmarkit_commonmark.of_doc;;
- : string = "~~~strike~~"

However, three tildes indicates the start of a fenced code block: commonmark.js preview. Reporting it here since it's not included in the known incorrect renderings list.

tysg avatar Mar 13 '24 10:03 tysg

Thanks.

Maybe the simplest is to unconditionally add ~ the set of characters that are unconditionally escaped at the start (first bullet here).

I suspect the same must be done for ` but I found another bug to be resolved first https://github.com/dbuenzli/cmarkit/issues/21

dbuenzli avatar Mar 13 '24 11:03 dbuenzli