commonmark / commonmark/commonmark.js

Leading and trailing non-`whitespace` `Unicode whitespace` is stripped from paragraphs

Open
#132 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

The CommonMark dingus implementation currently strips non-whitespace Unicode whitespace from
the start and end of paragraphs. The CommonMark specification and the cmark implementation seem to indicate that these characters should not be stripped.

Example link

Each "space" character in this example is U+1680, OGHAM SPACE MARK, chosen from the list of Unicode whitespace characters that are not in the list of whitespace characters.

Note that the leading and trailing U+1680 characters have been trimmed from the final result.

From CommonMark 0.28, section 4.8:

The paragraph’s raw content is formed by concatenating the lines and removing initial and final [whitespace].

By comparison, in cmark 0.28.3:

Input:

 o o 
 o o 

Output:

<p> o o 
 o o </p>

Ref: https://github.com/commonmark/CommonMark/pull/465

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 by reproducing the linked U+1680 example in the CommonMark dingus implementation and compare its output with the CommonMark specification and cmark 0.28.3. Locate the paragraph whitespace-trimming logic and any related tests. Done means leading and trailing U+1680 characters remain in the rendered paragraph, while ordinary whitespace handling remains correct.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.