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

sourcepos broken for tables and inlines and confusing CMARK_OPT_SOURCEPOS behavior #222

Open
martincizek opened this issue May 4, 2021 · 0 comments · May be fixed by #223
Open

sourcepos broken for tables and inlines and confusing CMARK_OPT_SOURCEPOS behavior #222

martincizek opened this issue May 4, 2021 · 0 comments · May be fixed by #223

Comments

@martincizek
Copy link

We've implemented an automated GFM editor, which depends heavily on sourcepos, which is currently widely broken. I will sum app all the issues here and then will link a pull request with the fixes.

I wanted to wait until the overlapping upstream pull request commonmark#298 is merged, but nothing happens for more than a year, although the objections against performance turned out to be negligible.

I kindly ask you to review this, as the GfmEditor is one of exciting use cases enabled by sourcepos. That means, incorrect sourcepos is not just a cosmetic bug affecting rendering appearance. It prevents whole category of automatic processing that would be possible with it.

  1. Sourcepos is incorrect on tables with preceding table-like paragraph:
    | paragraph |
    | header |
    | --- |
    | row |
    
  2. CMARK_OPT_SOURCEPOS is very confusing in terms how it affects the parser:
    • when it is not set on the parser, sourcepos is currently broken on all inlines
    • when it is set on the parser, sourcepos gets improved, but it is still far from correct
  3. Sourcepos is broken on strikethrough with softbreak:
    Hi ~~friend~~ and ~~other
    friend~~.
    
  4. Sourcepos is missing on softbreaks and linebrekas (at least we missed it a lot :))
  5. Sourcepos is broken for things mentioned in upstream PR Fix source positions for inlines. commonmark/cmark#298, i.e.:
    • Inlines inside inconsistently indented blocks.
    • Links/images.
    • Autolinks.
    • Escaped newlines.
    • Non-matched backticks.
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

Successfully merging a pull request may close this issue.

1 participant