Skip to content
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

Feature request: Less strict table parsing #26

Closed
huettenhain opened this issue Feb 4, 2018 · 3 comments
Closed

Feature request: Less strict table parsing #26

huettenhain opened this issue Feb 4, 2018 · 3 comments
Assignees
Labels

Comments

@huettenhain
Copy link
Contributor

Hey there!
To get the following table:

Column1 Column2
Data Data
Data Data

the Mistletoe parser would require the following code:

| Column1 | Column2 |
| ------: | :------ |
|    Data | Data    |
|    Data | Data    |

Many Markdown implementations I know allow the following:

| Column1 | Column2
| ------: | :------
|    Data | Data
|    Data | Data

and in fact, while typing this, I figured out that Github will even parse the following:

Column1 | Column2
------: | :------
   Data | Data
   Data | Data

I don't see a particular use for the latter, but the first one has often made it much easier for me to maintain visually appealing, ASCII-formatted tables where the last column contains content of very different lengths.

Would it be easy for mistletoe to support this as well? @miyuchina If this is not out of scope but you are busy, I can also try implementing this myself.

@miyuchina
Copy link
Owner

I didn't know this was possible! I don't think this is out of scope, and since CommonMark does not even support tables, we might as well do as we please, and make the syntax easier to write in 😃

I think if I were to do it, I should be able to get around to this in about a week, and I'll do another release to pypi after that. Would that be soon enough?

miyuchina pushed a commit that referenced this issue Feb 5, 2018
@miyuchina miyuchina self-assigned this Feb 5, 2018
@miyuchina
Copy link
Owner

Feature added in 566b234. Currently the shorthand form for tables still require a delimiter row. For, example, this is not a valid table:

00 | 01
10 | 11

But this is a table:

00  | 01
--- | ---
10  | 11

The reason for this is that the | character is still commonly used inline, and allowing tables without delimiter rows might cause many normal lines to be accidentally parsed as tables. (GFM, I noticed, also needs the delimiter row.)

@huettenhain What do you think?

@huettenhain
Copy link
Contributor Author

Fantastic! That was incredibly fast 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants