-
Notifications
You must be signed in to change notification settings - Fork 242
Open
Description
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:
- sourcepos broken for tables and inlines and confusing CMARK_OPT_SOURCEPOS behavior github/cmark-gfm#222
- Fix source positions for inlines. commonmark/cmark#298
Thank you for your assistance.
Metadata
Metadata
Assignees
Labels
No labels