hcoona/hexo-renderer-asciidoc

{} replacement sabotages use of passthrough with JS/CSS

aidanhs opened this issue · 4 comments

  return $.html()
             .replace(/{/g, '{')
             .replace(/}/g, '}');

If you're using asciidoc passthrough functionality (+++), '{' and '}' still gets replaced, making both JS and CSS broken.

Why do these two lines exist? It was added in 7f3559e with no explanation why.

Maybe related to hexojs/hexo@683fd0a?

But the markdown plugin doesn't do it - https://github.com/hexojs/hexo-renderer-marked/blob/master/index.js

I forgot why. I think it is related to the rendering of code blocks.

The asciidoctor engine is different from markdown engine.

I'm currently in some troubles and have no time to test & fix it.

I've figured away around this. If you do escape both asciidoc (++++) and hexo ({% raw %}):

Some asciidoc text

++++
{% raw %}
<script>(function () {alert(1);})()</script>
{% endraw %}
++++

Some more asciidoc text

It will work. I'll close this issue as it's not a problem.

Thanks for your time and the plugin, hope your troubles get better :)