Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I am using the Syntax Highlighter module as well as WYSIWYG filter in my text format, and finding that the classes that Syntax Highlighter interpret are being stripped because they contain a colon. For instance:
<pre class="brush:php">
<?php
print 'Hello world!';
?>
</pre>
After saving the node and then editing, the 'brush:php' class is being stripped because of the colon it contains. Any way to stop this from happening?
Proposed resolution
Use the alternative syntax described on the Syntax Highlighter project page. The example using <pre>
above should look like this:
{syntaxhighlighter class="brush:php"}
<?php
print 'Hello world!';
?>
{/syntaxhighlighter}
Comment | File | Size | Author |
---|---|---|---|
#4 | wysiwyg_filter-syntax_highlighter_fix-1804766-4.patch | 2.13 KB | vinmassaro |
Comments
Comment #1
jdjeet CreditAttribution: jdjeet commentedHi,
I guess you might have forget to keep the right order.
You need to follow the order of input format filters as described on syntax highlighter module.
As mentioned there, syntax highlighter comes after any and all filters that can modify content input.
Try this.
Comment #2
vinmassaro CreditAttribution: vinmassaro commentedActually, this is not the case. Syntax highlighter filter is always last - it's the WYSIWYG Filter stripping out the 'brush: php' class. Disabling the syntax highlighter filter shows the WYSIWYG Filter still removes the 'brush: php' class.
Comment #3
Renee S CreditAttribution: Renee S commentedAny luck with this?
Comment #4
vinmassaro CreditAttribution: vinmassaro commentedHere is a patch to wysiwyg_filter.pages.inc which disables class name cleanup if
brush:
is found. This allows the Syntax Highlighter class to be applied correctly.Comment #5
gisleI think this is a feature request (not a bug report), and it is now resolved in the Syntax Highlighter project. See updated issue summary.
Comment #6
geek-merlinThanx @gisle for clarifying and documenting this. Yes, so fixed.