leebyron / remark-comment

Remark plugin to support comments
MIT License
7 stars 4 forks source link

Fix multi-line comment bug #3

Open slorber opened 1 year ago

slorber commented 1 year ago

Fix https://github.com/facebook/docusaurus/issues/9084

The tokenizer had a problem handling comment openings immediately followed by a line break.

Note, I did not update one of the tests (It renders within HTML elements) because I believe it does not seem to support multi-line comments in the first place (starting with line breaks or not): that is probably a separate bug to fix.


Previous text before edit:

WIP: for now it's just a unit test proof that this library has the bug reported here: https://github.com/facebook/docusaurus/issues/9084

No CI, so proof of local failure with a simple test case change:

CleanShot 2023-06-22 at 15 06 33@2x
slorber commented 1 year ago

@leebyron PR is ready for review, tests are passing

cc @wooorm I'm not super comfortable with this micromark parsing logic so please let me know if you see any possible problem 🤪 that was a good opportunity to learn a bit.


Please let me know if you can review/merge/publish this soon because I need it for Docusaurus (https://github.com/facebook/docusaurus/issues/9084).

Otherwise, I can publish my fork. Or you can also give me npm/github permissions (slorber on both) in case you want another maintainer.

I tested the change on Docusaurus and it fixes our issue:

CleanShot 2023-06-22 at 16 28 42