Parsing an HTML comment that has trailing text includes the text in the HTML node.
markdown snippet:
<!-- some comment --> extra stuff
The extra stuff text should be included in its own node, separate from the HTML node.
The extra stuff text is included in the HTML node of the comment.
@chdsbd this is behaving as expected.
remark conforms to the commonmark standard https://commonmark.org
From the commonmark spec
Everything until the next blank line or end of document gets included in the HTML block. So, in the following example, what looks like a Markdown code block is actually part of the HTML block, which continues until a blank line or the end of the document is reached
~~~markdown
int x = 33;
~~~
https://spec.commonmark.org/0.29/#example-131
This is confirmed by the reference parser
https://spec.commonmark.org/dingus/?text=%3C!--%20some%20comment%20--%3E%20extra%20text%0A%0A%0A
Which parses
<!-- some comment --> extra text
as
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">
<document xmlns="http://commonmark.org/xml/1.0">
<html_block><!-- some comment --> extra text</html_block>
</document>
That being said, the above behavior could be achieved with a plugin.
This guide offers some good pointers on how to get started: https://unified.js.org/create-a-plugin.html
You can also check out the existing plugins to see if anyone else has created a plugin.
https://github.com/remarkjs/remark/blob/master/doc/plugins.md#list-of-plugins
Most helpful comment
That being said, the above behavior could be achieved with a plugin.
This guide offers some good pointers on how to get started: https://unified.js.org/create-a-plugin.html
You can also check out the existing plugins to see if anyone else has created a plugin.
https://github.com/remarkjs/remark/blob/master/doc/plugins.md#list-of-plugins