I've got the Syntax Highlighter working but it's still displaying everything on one line.

I've installed and enabled Wysiwyg Pre Element Fix 6.x-1.0-beta1 and Wysiwyg SyntaxHighlighter Plugin 6.x-1.2 as well as this module and the Syntax Highlighter and TinyMCE libraries. I set up Syntax Highlighter to do the languages I want and to use the

 tag (default).

I tried creating a unique format for it with no luck, so now I'm trying to do all this with the default Full HTML format.

The filters are ordered:
HTML filter
Syntax highlighter
Line break converter
URL filter
HTML corrector

I added 
 to the HTML filter.

TinyMCE 3.4.2 is the editor for the Full HTML format. I added the SyntaxHighlighter button. I turned off Remove Linebreaks. 

When I paste in code using the Syntax Highlighter button in TinyMCE, it initially displays all nicely indented. But when I save it, I get a single endless line. Is there anything else to try?

Comments

mattyoung’s picture

Maybe tinyMCE 3.4.2 breaks wysiwyg_syntaxhl and wysiwyg_preelementfix? preelementfix is supposed to prevent tinyMCE from removing whitespace inside pre tag. It's not working anymore for some reason. You can try asking help in wysiwyg_syntaxhl and wysiwyg_preelementfix.

I suggest you use the new 6.x-2.x-dev version. It's designed to be wysiwyg friendly. The new version does not use the {syntaxhighlighter} filter tag any more. It simply use the <pre> tag like this:

<pre class="brush: php">
... php code here...
</pre>

wysiwyg_syntaxhl was designed to work with the old {syntaxhighlighter} filter tag so it no longer work with this new version. You need to use the unmodified syntaxhighlighter tinyMCE plugin at http://27smiles.com/2008/04/07/tinymce-syntaxhighlighter-plugin/ or switch rich editor off to enter code.

NOTE: you must make sure your markup is proper HTML. This means if your code
have any HTML tags or entities in them, you need to change the '<' characters
to '&lt;' (e.g. <script> to &lt;script>), convert '&' in any HTML entity to
'&amp;' (e.g. &gt; to &amp;gt;).

(if you can reproduce the previous paragraph in HTML and come out looking exactly the same, then you know what I mean :). It's this in raw HTML:

NOTE: you must make sure your markup is proper HTML. This means if your code
have any HTML tags or entities in them, you need to change the '<' characters
to '&amp;lt;' (e.g. &lt;script> to &amp;lt;script>), convert '&amp;' in any HTML entity to
'&amp;amp;' (e.g. &amp;gt; to &amp;amp;gt;).
fizk’s picture

Status: Active » Closed (fixed)