Skip to content

tables versus hard breaks #318

@mity

Description

@mity

When tables extensions are enabled, any extra trailing spaces on any line in the following input should not cause that we treat it as a paragraph with a hard-break on that line.

Yet, if you place two spaces at the end of the 1st line, it does happen.

So this is ok:

$ printf 'foo|bar\n---|---\nfoo|bar' | ./pulldown-cmark -T
<table><thead><tr><th>foo</th><th>bar</th></tr></thead><tbody>
<tr><td>foo</td><td>bar</td></tr>
</tbody></table>

but the following is not:

$ printf 'foo|bar  \n---|---\nfoo|bar' | ./pulldown-cmark -T
<p>foo|bar<br />
---|---
foo|bar</p>

(I would expect the same output as before.)

Ditto if the hard-break is denoted with a backslash:

$ printf 'foo|bar\\\n---|---\nfoo|bar' | ./pulldown-cmark -T
<p>foo|bar<br />
---|---
foo|bar</p>

(I would expect the backslash is seen as a literal backslash, which becomes part of the respective table cell.)

Rationale: Hard-break is an inline, while table is a block. See https://spec.commonmark.org/0.29/#precedence

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions