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 range incorrectly detected for multiline text #183

Open
shp7724 opened this issue Jun 23, 2024 · 0 comments
Open

Strikethrough range incorrectly detected for multiline text #183

shp7724 opened this issue Jun 23, 2024 · 0 comments

Comments

@shp7724
Copy link

shp7724 commented Jun 23, 2024

The range for a multiline strikethrough is incorrectly detected when parsing a Markdown string using swift-markdown. Specifically, the detected range ends prematurely at the first line of the strikethrough block instead of spanning the entire multiline strikethrough content.

Steps to reproduce

let string = """
para1

~~this
is
multiline
strikethrough~~

para2
"""
let document = Document(parsing: string)
print(document.debugDescription(options: .printEverything))

Expected Output:

The strikethrough range should correctly span from the start of the first line to the end of the last line, i.e., from 3:1 to 6:16.

Actual Output:

The strikethrough range is detected as 3:1-3:16, which only covers the first line of the multiline strikethrough block:

Document @1:1-8:6 Root #2 #0
├─ Paragraph @1:1-1:6 #1
│  └─ Text @1:1-1:6 #2 "para1"
├─ Paragraph @3:1-6:16 #3
│  └─ Strikethrough @3:1-3:16 #4
│     ├─ Text @3:3-3:7 #5 "this"
│     ├─ SoftBreak #6
│     ├─ Text @4:1-4:3 #7 "is"
│     ├─ SoftBreak #8
│     ├─ Text @5:1-5:10 #9 "multiline"
│     ├─ SoftBreak #10
│     └─ Text @6:1-6:14 #11 "strikethrough"
└─ Paragraph @8:1-8:6 #12
   └─ Text @8:1-8:6 #13 "para2"

Strikethrough @3:1-3:16 #4

Environment:

  • swift-markdown version: 0.4.0
  • Xcode version: 15.4.0

Questions:

  • Is this behavior from the upstreams, such as cmark-gfm?
  • Can this possibly be fixed in a future release?

Related issues found:

Thank you for your assistance.

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

1 participant