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

All: Add function that allows SVG inside of HTML to be converted to resources #10641

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

pedr
Copy link
Collaborator

@pedr pedr commented Jun 20, 2024

Summary

When adding OneNote importer we found it important also to support SVGs.

This PR adds a function that takes an HTML string, parses it until it finds an svg tag and extracts the content to be stored as a resource, replacing the original node with an `img' tag.

This function is only responsible for removing the content and returning as an array of objects with name and content. My idea is that the caller can create the function that will create the resources on disk, especially because it is easier to test this way.

Some things that can still be improved:

  • add name to the tests so it is easier to check what tests is what snapshot
  • add more tests, verify OneNote tests and other added in the previous PR about SVG

Testing

I'm adding more tests, but for now I'm using snapshot testing so we can compare the two HTML.

@pedr pedr changed the title All: Add function that can replace SVG node with img All: Add function that allows SVG inside of HTML to be converted to resources Jun 20, 2024
@pedr pedr mentioned this pull request Jun 20, 2024
4 tasks
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