Chimo
Forum Replies Created
-
Forum: Plugins
In reply to: [WP-Syntax] [Plugin: WP-Syntax] HTML5 highlighting?Hi,
Since HTML4 and HTML5 share a lot of elements/attributes, there is partial highlighting for HTML5 in version 0.9.12.If you need complete HTML5 highlight support, you can easily update GeSHi to version 1.0.8.10 by downloading it from here: http://qbnz.com/highlighter/ and replacing the “geshi” folder located in “/wp-content/plugins/wp-syntax” with the one you downloaded from above.
The “lang” attribute you’ll want to use is “html5”:
<pre lang="html5">HTML5 code here.</pre>Forum: Plugins
In reply to: WordPress WYSIWYG delete "line" attributeHi,
I never noticed before this but yes, according to this (and my own testing seems to confirm it is true) it does _replace_ the list of valid attributes.You will need to add the attributes you want allowed on “pre” in the code above (ex. for “class”: $extra = ‘pre[class|lang|line|escaped|style|width|highlight]’;) or just use “*” if you want to allow all attributes (ex: $extra = ‘pre[*]’;)
For reference, by default “pre” gets its list of valid attributes from the “default rule set” defined here
Edit: more specifically, the default attributes for “pre” seem to come from the “@” rule which states: “[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|”
+ “onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|”
+ “onkeydown|onkeyup]”Forum: Plugins
In reply to: WordPress WYSIWYG delete "line" attributeHi,
You can try adding this to the top of wp-content/plugins/wp-syntax/wp-syntax.php (although ideally you might want to make this a separate plugin so the changes don’t get deleted next time wp-syntax gets updated):
// Allow 'line', 'escaped' and 'highlight' attributes on <pre> in TinyMCE function tinymce_add_preAttr( $arr = array() ) { $extra = 'pre[lang|line|escaped|style|width|highlight]'; if ( isset( $arr['extended_valid_elements'] ) ) { // append to existing value $arr['extended_valid_elements'] .= ',' . $extra; } else { // set the value $arr['extended_valid_elements'] = $extra; } return $arr; } add_filter('tiny_mce_before_init','tinymce_add_preAttr');Next time you load the WYSIWYG-editor, it should accept the necessary attributes on the “pre” tag.
( Credits: adapted from http://wordpress.stackexchange.com/questions/14363/switching-from-html-to-visual-editor-and-back-completely-strips-page-contents/14408#14408 )