How do I add my code snippet’s to my post
Posted on 23. Nov, 2006 by Dave in Tutorials
If you liked this post, please subscribe! You’ll be glad you did!
If you’d like to add a code snippet to your post, you may now do so thanks to a new plugin we recently added. The plugin works by escaping most special HTML tags and characters so they display exactly as typed, but allowing certain tags to be rendered as normal HTML. The default set of allowed tags is the standard formatting tags like em, strong, span and so on. You can control this explicitly, or implicitly by specifying the language of the code block. For example, in a normal code block,
1 | <em></em> |
will be rendered as emphasised text, but in an HTML code block,
1 | <em></em> |
will be displayed as
1 | <em>.</em> |
Here’s how to format your code for Code Markup.
[code lang="html"]
* Enclose all code inside a
1 2 3 | block. * Include any HTML markup you like in the code, for example to add emphasis to certain sections. * Separate |
1 2 3 4 5 | blocks should be nested within a <pre> block to preserve whitespace. If you want to fine-tune how Code Markup treats your code, use the allow and lang attributes on the code tag to specify how Code Markup should handle it. * <code> or |
1 2 | allows common HTML tags to be rendered, and displays everything else exactly as written. * |
1 2 | displays content exactly as written — no markup allowed. * |
1 2 | renders content as HTML — all markup is allowed. * |
1 2 | allows only <em>, <strong> and <a> tags to be rendered as HTML — everything else is displayed exactly as written. You can put whatever tags you like in the allow attribute, separated by spaces. As a special case, you can include the comment tag — this means that HTML comments <!-- like this --> will be “rendered†as normal HTML comments (i.e. not displayed). * <code lang="html"> or |
1 | displays content exactly as written, the same as |
1 2 3 4 | . The allow attribute overrides the lang attribute. [/code] |












Recent Comments