vim-pandoc / vim-pandoc-syntax

pandoc markdown syntax, to be installed alongside vim-pandoc
MIT License
425 stars 61 forks source link

Does this help with automatically figuring out highlight? #348

Open alok opened 3 years ago

alok commented 3 years ago

https://github.com/jgm/pandoc/issues/4565

fmoralesc commented 3 years ago

Yes. I have a bit more time now because I finished my thesis, so I was looking into plugging this into the plugin. I was thinking of making a prototype using the neovim lua highlighting facilities, I don't know if that will be generally usable but it will be a start.

alerque commented 3 years ago

@alok Yes it does! It has some caveats because it's for the CommonMark parser only, not the old Pandoc parser, but it's progress.

This issue is mostly a duplicate of #300 and #327. We've actually been tinkering with this for a while, and we were actually one of the ones pushing for that feature. It's exciting to see it finally landing.

fmoralesc commented 3 years ago

Indeed! The only worry I have for now is the speed of the parsing step itself -- @alerque, we tried commonmark-hs, right? It wasn't as fast as the rust library if I remember correctly.

alerque commented 3 years ago

At the time I tried the Haskel library that I assume the Pandoc app is now using it was at least an order of magnitude slower that the Rust based parser I was experimenting with. It's really interesting to have truly Pandoc generated AST mappings, but if this is limited to Common Mark anyway it probably isn't our fastest option by a long shot.

fmoralesc commented 3 years ago

I think that the fact that it gives a full map of the source is excellent, though. We can use that information to cache more intelligently: for example, only redraw the paragraphs that were just edited--in that case we can compensate for the slow parsing with feeding pandoc less data.