Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strikethrough rendering should be configurable #168

Open
rahilb opened this issue Feb 29, 2024 · 1 comment
Open

Strikethrough rendering should be configurable #168

rahilb opened this issue Feb 29, 2024 · 1 comment

Comments

@rahilb
Copy link

rahilb commented Feb 29, 2024

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 ~~.

@QuietMisdreavus
Copy link
Contributor

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.

@rahilb rahilb changed the title Strikethrough text is reformatted by format() Strikethrough rendering should be configurable Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants