1

I am using syntaxhighlighter on a blogger blog. All is working fine, except when the code I want to show contains a <br/> tag, it gets displayed as a new line. This is despite it being HTML encoded (and the following visible in the view source):

&lt;br/&gt;

Is this a bug in syntaxhighlighter? Or is there anything else I can do to fix it?

2 Answers 2

3

See Blogger Mode.

Blogger Mode Blogger has a nasty habit of replacing all new lines with <br/> tags which makes it impossible to post code snippets. To fix the situation version 1.5.1 introduces "Blogger Mode" which can be enabled before a call to HighlightAll() by a call to BloggerMode() like in the example below:
    dp.SyntaxHighlighter.BloggerMode();
    dp.SyntaxHighlighter.HighlightAll('code');
1
  • it was blogger mode that was the problem. I needed to turn it off
    – Mark Heath
    Commented Oct 6, 2010 at 11:02
2

I've worked it out. It was actually turning on syntaxhighlighter's "blogger mode" that caused the problem. Turning it off works just fine.

See line 908 in http://bitbucket.org/alexg/syntaxhighlighter/src/tip/scripts/shCore.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.