commonmark / commonmark/commonmark.js
Incorrect handling of tabs in link resources compared to spaces, newlines
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.6k
- Forks
- 231
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 3
Description
- Spec currently defines whitespace can exist, and in some cases must exist around the destination and title, in the parens: https://spec.commonmark.org/0.29/#inline-link
- I clarified the wording recently in https://github.com/commonmark/commonmark-spec/pull/618
- But
whitespacewas used since the start: https://github.com/commonmark/commonmark-spec/blame/858a28941d0dd17c24b7240f21372652111bd38b/spec.txt#L7495
The bug probably stems from here: https://github.com/commonmark/commonmark.js/blob/8c698a295f7cea58597769ccfaab2219add45e44/lib/inlines.js#L651, which seems to include spaces and newlines but not tabs.
This bug can be reproduced with the following permalink to the dingus: https://spec.commonmark.org/dingus/?text=tab%3A%20%5Bx%5D(%09y)%0Aspace%3A%20%5Bx%5D(%20y)%0A%0Atab%3A%20%5Bx%5D(y%09)%0Aspace%3A%20%5Bx%5D(y%20)%0A%0Atab%3A%20%5Bx%5D(%09%3Cy%3E)%0Aspace%3A%20%5Bx%5D(%20%3Cy%3E)%0A%0Atab%3A%20%5Bx%5D(y%09%22z%22)%0Aspace%3A%20%5Bx%5D(y%20%22z%22)%0A.
The expected behavior is that tabs and spaces behave the same.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lib/inlines.js around line 651 and reproduce the tab and space cases using the linked dingus permalink. Compare handling around link destinations and titles, then verify that tabs and spaces behave the same in each listed case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100