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

Support the hast "comment" node type, and support header comments that contain <tags> #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AndrewDicks
Copy link

Hi

Thanks for this useful tool. I'm submitting this PR for two reasons:

  1. hast comment node-type support
  2. A bug when parsing pre-root-tag comments that contain -style text

Support the hast comment node-type

I noticed that comments were being stripped from SVGs - for a variety of reasons I needed to keep them, so I forked your repo and implemented the hast comment node type.

Bug in parsing header/metadata comments that contain

If a comment in the header section contains a , the parser fails to parse the file. e.g. this SVG would fail to parse due to the tag in the comment. Tags are legal in HTML comments, and should not be escaped to < / >.

<?xml version="1.0" standalone="yes"?>
<!-- pre-root-element comment with <some tag/> in it -->
<svg xmlns="http://www.w3.org/2000/svg"></svg>

I've also written tests for this extra functionality, and updated the expected output from your original comment test.

Kind regards

Andy

Improved parsing header/metadata to support SVGs with leading comments that (legally) contain <tags>
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 this pull request may close these issues.

None yet

1 participant