commonmark / commonmark/commonmark.js

Link destination parsing accepts control characters (but should not)

Open
#127 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.6k
Forks
231
Avg merge
2d 11h
Merged PRs (30d)
3

Description

From the spec:

A link destination consists of either
[...]

  • a nonempty sequence of characters that does not include ASCII space or control characters [...]

In https://github.com/commonmark/commonmark.js/commit/531fd57c0777896471d1f9773d40c506b28e9d38, it looks like the handwritten parser doesn't stop on control characters. Saw this while looking at the changes for the new spec.

This can be verified using the JS API on dingus:

new commonmark.HtmlRenderer().render(new commonmark.Parser().parse("[a](\x01)"))

Results in:

"<p><a href=\"%01\">a</a></p>
"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the JavaScript API reproduction in the issue and trace the handwritten link-destination parser it exercises. Use the CommonMark specification's control-character rule as the expected behavior; done means the control character is not accepted as the destination and the shown href is no longer produced.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.