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

Table extension does not follow GFM spec (cannot interrupt a paragraph) #15

Closed
acnebs opened this issue Mar 18, 2022 · 5 comments
Closed

Comments

@acnebs
Copy link
Contributor

acnebs commented Mar 18, 2022

In the GFM spec, all leaf blocks are allowed to interrupt a paragraph, for example a fenced code block can appear in the text immediately after other text with no line breaks, like so:

const x = 3

And this markdown parser respects that part of the spec. However, I've noticed that the Table extension provided by the lib does not follow this convention, and if a Table interrupts a paragraph lezer does not recognize it as such.

Easiest way to demonstrate is probably that Github's markdown parser, which follows the spec exactly AFAIK, allows this behavior, like so:

Syntax Description
Header Title
Paragraph Text

Anyway just thought I'd point this out, thanks for making such a cool parsing library!

@acnebs acnebs changed the title Table extension does not follow GFM spec Table extension does not follow GFM spec (cannot interrupt a paragraph) Mar 18, 2022
@acnebs
Copy link
Contributor Author

acnebs commented Mar 18, 2022

Thanks @marijnh, looks great! Would you mind tagging this as a new version?

@marijnh
Copy link
Contributor

marijnh commented Mar 18, 2022

Sure -- done

@acnebs
Copy link
Contributor Author

acnebs commented Mar 21, 2022

Awesome, thank you. I think @codemirror/lang-markdown might need to be bumped too though, as I'm now seeing some type incompatibilities between the two (specifically around the MarkdownExtension type).

@marijnh
Copy link
Contributor

marijnh commented Mar 21, 2022

No, just reinstall your dependencies to force npm to properly deduplicate them (it has an issue where upgrading will often inappropriately install multiple versions of a package).

@acnebs
Copy link
Contributor Author

acnebs commented Mar 29, 2022

Additionally, is there a reason why BlockContext methods like scanLine and readLine are marked as internal with typescript hints? I mean, I understand why in that if you used the private qualifier it would not be accessible to the built-in extension implementations (like Table) in extensions.ts, but personally I think it would be nice if all of the built-in extensions used only the publicly accessible library API so that they can be easily used as a reference when users build out their own @lezer/markdown extensions.

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

No branches or pull requests

2 participants