aramk / crayon-syntax-highlighter

Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.
https://wordpress.org/plugins/crayon-syntax-highlighter/
GNU General Public License v3.0
1.1k stars 248 forks source link

Unclosed span element when formatting 8 spaces. #243

Open sumhat opened 9 years ago

sumhat commented 9 years ago

I got an unclosed span element in one of my blog posts, like below. The first span in the 2nd div is not closed. Page url: http://leonax.net/p/6732/block-spam-comments-from-web-page/ line 120.

<div class="crayon-line" id="crayon-549d403494404673971396-5">
  <span class="crayon-s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input type="hidden" id="leonax-magic" name="leonax-magic" value="0"&gt;</span>
</div>
<div class="crayon-line crayon-striped-line" id="crayon-549d403494404673971396-6">
  <span class="crayon-s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <span class="crayon-ta">&lt;script </span>
  <span class="crayon-e ">type</span>
  <span class="crayon-o">=</span>
  <span class="crayon-s">"text/javascript"</span>
  <span class="crayon-o">&gt;</span>
</div>

Not sure what went wrong and how debug it, I post an issue here for further investigation. I am still studying the code. It will be very helpful if you can point out where could be wrong.

sumhat commented 9 years ago

It has something to do with mixed language parsing. I turned it off now, and it looks good.

aramk commented 9 years ago

Can you show the raw post HTML that causes the issue so I can reproduce it?

sumhat commented 9 years ago

See https://gist.github.com/sumhat/cc4ef49f70b664c24762

With mixed language support enabled.