commonmark / commonmark/commonmark.js

Trailing tabs after closing fence marker

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

Test case:

$ cat test.md | sed 's/\t/<TAB>/g'
```
foo
```<TAB>
bar

Commonmark.js doesn't close fence because there's a trailing tab there:

$ ~/commonmark/bin/commonmark ./test.md 
<pre><code>foo
```	
bar
</code></pre>

Cmark disagrees:

$ ~/cmark/build/src/cmark ./test.md 
<pre><code>foo
</code></pre>
<p>bar</p>

There is no test in the spec for this exact case. But there is a similar case for thematic breaks (example 11) where trailing tabs are expanded to spaces:

$ echo -e ' -\t-\t-\t' | ~/commonmark/bin/commonmark 
<hr />

Also, consider the following case (imagine if user appends tabs everywhere):

```js<TAB>
foo<TAB>
```<TAB>
bar<TAB>

If line 1 is considered fence opener (as it does in both implementations), surely line 3 should be considered a closer?


Original issue is opened as markdown-it#388, which behavior is the same as cmark in this case.

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 issue with the commands and fenced-markdown examples in the report, then compare commonmark/bin/commonmark with cmark. Done means trailing tabs after a closing fence are handled consistently and the reported cases are covered by a regression test; no test file is named in the issue.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.