Conventional Comments Parser

A parser for turning conventional comments into JSON.

This is a parser that will parse conventional comments and return an output in JSON as per their specification. Check out the examples below!


@alice

suggestion: Let's avoid using this specific function...

If we reference much of a function marked "Deprecated", it is almost certain to disagree with us, sooner or later.


Waiting...

Now a nitpick with a decoration:


@hatter

nitpick (non-blocking): little star => little bat

Can we update the other references as well?


Waiting...

Nice! What happens with an invalid comment?


@caterpillar

This is not worded correctly.


Waiting...

What if I use an unsupported label?


@7ofspades

i-have-a-problem-with-this: Why won't my label work?


Waiting...

Does it work with markdown? (Note: markdown is visible for demo purposes)


@amouse

**question (non-blocking):** At this point, __does it matter__ which thread has won?

Maybe to prevent a race condition we __should keep looping until they've all won__?

This is a second paragraph to show that the parser will return all follow up paragraphs as part of the discussion.


Waiting...

For now, markdown is preservered within the subject and discussion but maybe in the future we could (optionally) remove this.


Try it out yourself:


Waiting...

How does this work?

I wrote a dedicated JS package that exposes a parse function, which accepts a string as a parameter. The examples above are just using innerText from selectors and passing it to this function.


The package I created uses a nearley.js grammar which produces a method of parsing the string and returning it in a way that can be processed (in this case, transformed into JSON).


The package is available on GitLab but is still mostly a work in progress.