apple/swift-markdown

Strikethrough rendering should be configurable

Opened this issue · 1 comments

It is expected that if I parse and then format a markdown document I should be able to get a rendered string that is identical to the input string, i.e. it should be possible to satisfy the condition markdownString == (parse(markdownString).format())

However parsing the following document:

~~line 1~~
~~line 2~~

and immediately calling .format()

results in the following string:

~line 1~
~line 2~

ExtendedMark defines strikethrough using ~~ https://www.markdownguide.org/extended-syntax/#strikethrough

Commonmark does not specify Strikethrough elements and all the specifications I can find call for ~~.

The library is able to parse the strikethrough element, e.g.

├─ Paragraph
│  ├─ Strikethrough
│  │  └─ Text "line 1"
│  ├─ SoftBreak
│  └─ Strikethrough
│     └─ Text "line 2"

Suggestion: Rendering of the Strikethrough ADT element should be configurable or changed to render as ~~.

Swift-Markdown is based the GitHub-Flavored Markdown specification, which allows one or two tildes for strikethrough. The formatting is only meant to be semantically equivalent to the input, not textually equivalent. We can use this issue to track configurable strikethrough markers, though, so that your example can still format as desired.