Prism4j
Prism4j copied to clipboard
Empty string input crashes
https://github.com/noties/Markwon/issues/192
I'm having this issue with the following markdown file https://raw.githubusercontent.com/yahoo/gifshot/master/README.md
Is there any idea on how to solve this in Prism4j?
Hello @Meisolsson !
At first I thought those 2 issues are unreleated. As markdown file that you'd linked does not contain empty code blocks. Then I have found out that the block that fails is:
<script src='gifshot.js'></script>
which does not make sense as it is not empty. If you change script
to any other tag, then no crash happens 🤔 . It turns out that javascript
grammar injects itself into html
grammar to handle this specific case -> javascript code inside <script>
tags. But then it is invoked with empty string (as tag does not contain any text)
Alright, any idea how to solve it? I'm guessing that the check causing the crash is required for something else.
The fix must be implemented in the library - Prism4j
must not tokenize empty inputs
The fix must be implemented in the library -
Prism4j
must not tokenize empty inputs
Is this fix published or we need to do some dependency workaround to include a fork?
Mine version is 2.0.0, which seems to be the latest, and it's failing for this markdown file:
https://github.com/adambard/learnxinyminutes-docs/blob/master/amd.html.markdown
(disregard the frontmatter since it's not being passed to the markown -> prism4j library).