vuepress-theme-hope / vuepress-theme-hope

A vuepress theme with tons of features✨
https://theme-hope.vuejs.press
MIT License
2.09k stars 736 forks source link

[Bug] closing `script` tag in code block cause unexpected termination in slides #3296

Closed TeddyHuang-00 closed 1 year ago

TeddyHuang-00 commented 1 year ago

Checklist

Package name

vuepress-theme-hope

Which operating system are you using?

Describe the bug

If presenting HTML code in slides provided by reveal.js, and if including a ending script tag (like the one below), the result slide will unexpectedly end at the </script>. Similar syntax works fine in normal post, see the provided repo for a full reproduction and comparison.

---

<!-- .slide: data-transition="slide" -->

## HTML code block

```html
<script>
  alert("Hello World!");
</script>



### Additional context

See the changes and effect in this repo for a minimal reproduction of the bug:

https://github.com/TeddyHuang-00/ScriptInReveal
Mister-Hope commented 1 year ago

It's kind of reveal limitation. As the content will be parsed by browser.

You can use zero wide space \u200b to break these kind of characters.

Mister-Hope commented 1 year ago

I try to add a patch and it works. And I think this should be built at your side.

image

TeddyHuang-00 commented 1 year ago

Alright, I think this is a solution good enough as this is a upstream issue. Thanks a lot for that!