commonmark / commonmark/commonmark.js

Leading and trailing spaces vanish in multi-line "link text"

Open
#119 3 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

In this example, the spaces are preserved:

[ a ](b)

In that example, however, the spaces are swallowed:

[ 
 a 
 ](b)

Even stranger, the first space after the opening bracket creates an empty <text></text> element in the AST, while the last space before the closing bracket creates nothing.

http://spec.commonmark.org/dingus/?text=%5B%20a%20%5D(b)%0A%0A%5B%20%0A%20a%20%0A%20%5D(b)

Most (all?) CommonMark parsers show the same awkward behavior:

http://johnmacfarlane.net/babelmark2/?text=%5B+a+%5D(b)%0A%0A%5B%0A+a+%0A%5D(b)

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

No repository file, test, or entry point is named. Start by reproducing both link-text examples from the issue and inspecting their AST output, then trace the multiline link parsing behavior and compare it with the single-line case. Done means the handling of leading and trailing spaces is consistent and covered by regression tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.