Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Recommended way to add allowed style classes?
Hi all,
I noticed that since updating to 2.2, the GeSHI syntax highlighter plugin I'm using has broken. Some poking around reveals that the HtmLawed plugin is stripping out all of the class attributes, so I'm just left with a bunch of blank span tags.
To fix it I had to edit class.htmlawed.plugin.php and add a number of allowed classes (geshi_syntax, code, br0, co2, kw2, kw4, kw5, nu0, objc, sy0, probably more, but these are what I found in one render).
Is there a recommended way of doing this, from within the GeSHI plugin itself, that doesn't require this hack approach?
Is there a better way to approach this problem?
Cheers,
Michael
0
Comments
You can use the
AfterCommentFormat
event which is fired after a comment (or discussion) body has been handled by HTMLawed.https://github.com/vanilla/vanilla/blob/b94c27ed88badd5320aec68a1f648d1ef89e5790/applications/vanilla/views/discussion/helper_functions.php#L24
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Thanks @Bleistivt - I did give that a go, but the problem is it's actually formatting the content within the pre/code blocks, which breaks the syntax highlighter. GeSHI's gotta be able to operate on the raw body, without the added html.
Something like this should work:
Basically replace code blocks with an identifier that survives the transformation and then replace those with geshis output.
Or try if the "Syntax Prettifier" plugin that ships with 2.2 fits your needs.
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Oh! Syntax Prettifier works great! I didn't see that in the plugins list. That solves my problem nicely. Thank you very much
Hi @Bleistivt ,
I'm want to make GeSHi plugin working too. Syntax Prettifier is not an option for me because it doesn't support matlab/scilab code.
Is the answer above still valid in 2020? I'm not able to get it working. (Vanilla 3.3)
Thanks