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

Don't fail on missing code tag in code block parsing #27

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

dbohn
Copy link

@dbohn dbohn commented Aug 11, 2022

When parsing an HTML input using this library, that contains a <pre>-tag without any child element like the code tag generated by TipTap itself, the parser will generate an error, as it tries to call the getAttribute method on a child node, that is of type DOMText (or even null, if the block is empty). The error occurs, while infering the language of the code block.

This might not happen, if using the tip tap editor, but it breaks the use case of the sanitize method, as it would fail and not sanitize in this case.

This PR adds a check for the type of the respective child node.

@dbohn dbohn force-pushed the fix-invalid-codeblock-parsing branch from 7ade101 to 5489beb Compare August 11, 2022 09:23
@nperez0111 nperez0111 force-pushed the fix-invalid-codeblock-parsing branch from 5489beb to fb0ce1d Compare August 12, 2024 08:16
@nperez0111 nperez0111 force-pushed the fix-invalid-codeblock-parsing branch from fb0ce1d to d7d6303 Compare August 12, 2024 08:19
@nperez0111 nperez0111 merged commit c9e4d37 into ueberdosis:main Aug 12, 2024
13 of 14 checks passed
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.

2 participants