Hi,

I'm trying to use this filter to work for http://drupal.org/project/syntaxhighlighter

It uses markup like this:

<pre class="brush: java">
     some java code
</pre>

or a little more complicated:

<pre class="brush: java;auto-link:true;collapse:false;highlight:[5,10,21];ruler:false">
     some java code
</pre>

It basically uses the CSS syntax as class name. I need that class attribute pass through verbatim.

I tried adding this rule

pre[class]

In Advanced rules, Class name rules:
a-z*

But the class attribute is always stripped.

Is it possible to allow class attribute through in this syntax?

Comments

markus_petrux’s picture

Status: Active » Closed (won't fix)

Nope. You can't. Class Names should start with a lower case letter "a-z" and can be followed by one or more lower case letters "a-z", digits "0-9", hyphens "-" and/or underscores "_". Adding more characters would complicate things too much. Also, anything like "foo:bar" can be confused with bad protocols.

Instead, maybe you could use macros. ie. something like:

[syntaxhighlighter brush:java;auto-link:true;collapse:false;highlight:[5,10,21];ruler:false]
     some java code
[/syntaxhighlighter]

Then, an input format filter with a weight higher than other filters can convert this into HTML.

mattyoung’s picture

Okay, got it. I will do a filter then.

Thanks!