New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tab-related regressions #59

Closed
rlidwka opened this Issue Jul 16, 2015 · 5 comments

Comments

Projects
None yet
2 participants
@rlidwka

rlidwka commented Jul 16, 2015

I didn't quite understand 0.21 spec changes related to tabs. The general idea seems good, but devil is in the details as they say. So I checked this implementation, unfortunately, it's behavior appears to be buggy.

Tab immediately after list item marker was allowed, now it's not. Is it intentional?

$ echo -e ' -\tlist' | ./commonmark-0.20
<ul>
<li>list</li>
</ul>

$ echo -e ' -\tlist' | ./commonmark-0.21 
<p>-    list</p>

If code block indentation is using half a tab, what happens?

$ echo -e ' - foo\n\n\t\tbar' | ./commonmark-0.20
<ul>
<li>
<p>foo</p>
<pre><code> bar
</code></pre>
</li>
</ul>

$ echo -e ' - foo\n\n\t\tbar' | ./commonmark-0.21
<ul>
<li>
<p>foo</p>
<p>ar</p>
</li>
</ul>

Variation of the bug above. But it might deserve a special place because it's unclear whether - \t\tcode should be a code block or not (might be a bug in 0.20 actually):

$ echo -e ' - \t\tcode' | ./commonmark-0.20
<ul>
<li>code</li>
</ul>

$ echo -e ' - \t\tcode' | ./commonmark-0.21 
<ul>
<li>
<pre><code>de
</code></pre>
</li>
</ul>
@jgm

This comment has been minimized.

Show comment
Hide comment
@jgm

jgm Jul 16, 2015

Member

Yes, these are all bugs.

Note that cmark behaves correctly in each case. Since the code is fairly similar, it shouldn't be too hard to fix these.

Member

jgm commented Jul 16, 2015

Yes, these are all bugs.

Note that cmark behaves correctly in each case. Since the code is fairly similar, it shouldn't be too hard to fix these.

@jgm

This comment has been minimized.

Show comment
Hide comment
@jgm

jgm Jul 16, 2015

Member

Actually, there's an interesting question about this case:

echo -e ' - foo\n\n\t\tbar' | cmark
echo -e ' - foo\n\n        bar' | cmark

One might think from the spec that these would be equivalent. However, they're not; in the second case, but not the first ,we get a space at the start of the code block. Actually, that strikes me as reasonable behavior -- after all, there's no space character in the code block. But I don't think the spec ties this down tightly enough.

Member

jgm commented Jul 16, 2015

Actually, there's an interesting question about this case:

echo -e ' - foo\n\n\t\tbar' | cmark
echo -e ' - foo\n\n        bar' | cmark

One might think from the spec that these would be equivalent. However, they're not; in the second case, but not the first ,we get a space at the start of the code block. Actually, that strikes me as reasonable behavior -- after all, there's no space character in the code block. But I don't think the spec ties this down tightly enough.

@jgm

This comment has been minimized.

Show comment
Hide comment
@jgm

jgm Jul 16, 2015

Member

We should add test cases to the spec with tabs after list markers, block quote markers, and elsewhere.

Member

jgm commented Jul 16, 2015

We should add test cases to the spec with tabs after list markers, block quote markers, and elsewhere.

@jgm

This comment has been minimized.

Show comment
Hide comment
@jgm

jgm Jul 16, 2015

Member

Note to self: I'm not convinced cmark is quite right either, looking at the code.

echo -e '1.\t\thi' | ./cmark

It should give you a code block with a space at the beginning, according to the spec, but it doesn't.

Member

jgm commented Jul 16, 2015

Note to self: I'm not convinced cmark is quite right either, looking at the code.

echo -e '1.\t\thi' | ./cmark

It should give you a code block with a space at the beginning, according to the spec, but it doesn't.

@jgm

This comment has been minimized.

Show comment
Hide comment
@jgm

jgm Aug 8, 2015

Member

Note that 94053a8 fixes the missing characters problems in the original cases above, but we still have the problem that we're getting a regular paragraph rather than a code block.

% echo -e ' - foo\n\n\t\tbar' | bin/commonmark 
<ul>
<li>
<p>foo</p>
<p>bar</p>
</li>
</ul>
Member

jgm commented Aug 8, 2015

Note that 94053a8 fixes the missing characters problems in the original cases above, but we still have the problem that we're getting a regular paragraph rather than a code block.

% echo -e ' - foo\n\n\t\tbar' | bin/commonmark 
<ul>
<li>
<p>foo</p>
<p>bar</p>
</li>
</ul>

xxgreg pushed a commit to xxgreg/commonmark.js that referenced this issue Sep 14, 2015

jgm added a commit that referenced this issue Dec 28, 2015

Fixed a list/tab/padding corner case.
    echo -e ' - foo\n\n\t\tbar' | bin/commonmark

from #59.

jgm added a commit that referenced this issue Dec 28, 2015

@jgm jgm closed this in 3ffa893 Dec 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment