Code Markup
Code Markup is a WordPress plugin that makes it easy to include program code samples in your posts.
Plugin info
Maintenance & Compatibility
Maintenance score
Possibly abandoned • Last updated 6470 days ago
Is Code Markup abandoned?
Possibly abandoned (last update 6470 days ago).
Compatibility
Similar & Alternatives
Explore plugins with similar tags, and compare key metrics like downloads, ratings, updates, support, and WP/PHP compatibility.
Description
Code Markup is a WordPress plugin that makes it easy to include program code samples in your posts. You can even include HTML markup in the code sample; Code Markup magically knows which characters should be displayed as code and which should be rendered as HTML.
The plugin works by escaping most special HTML tags and characters so they display exactly as typed, but leaving certain ones alone so they will render 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, will be rendered as emphasised text, but in an HTML code block, will be displayed as .
(I have to use square brackets instead of angle brackets because of the WordPress Extend site formatting.)
USAGE
-
Enclose any code inside a
block. -
Use
to specify appearance of code.- Include any HTML markup you like in the code, for example to add emphasis to certain sections.
- Separate
blocks should be nested within ablock to preserve whitespace.
-
If you want to fine-tune how Code Markup treats your code, use the markup and lang attributes on the code tag to specify how Code Markup should handle it.
orallows common HTML tags to be rendered, and displays everything else exactly as written.displays content exactly as written ? no markup is rendered.renders content as HTML ? all markup is rendered.treats , and tags as HTML markup ? everything else is displayed exactly as written. You can put whatever tags you like in the markup attribute, separated by spaces. As a special case, you can include the comment tag ? this means that HTML comments will be ?rendered? as normal HTML comments (i.e. not displayed).ordisplays content exactly as written, the same as.
-
The markup attribute overrides the lang attribute.
-
Separate
blocks should be nested within ablock to
preserve whitespace.
Installation
- Copy code-markup.php into your WordPress plugins directory (wp-content/plugins).
- Log in to WordPress Admin. Go to the Plugins page and click Activate for Code Markup.
- Go to the Options page and click Writing. Make sure “WordPress should correct invalidly nested XHTML automatically” is NOT checked. (Otherwise it may do funny things to your code listings.)
Frequently Asked Questions
What is this good for?
The plugin allows you to quickly copy and paste code into your blog, and add HTML markup to it to emphasise certain parts of it. Normally this is not possible without a lot of fiddly manual editing.
what tags are allowed by default?
If the code block has its lang attribute set to html or xhtml, then no tags are allowed: all tags are escaped and will display as typed. Otherwise the following tags are allowed: em strong b i ins del a span
How do I change the default behaviour?
To make the code block render as straight HTML, set the code block’s “markup” attribute to “all”. In this case, make sure that you have typed correct HTML!
To make the code block display exactly as typed, set the code block’s “markup” attribute to “none”.
To allow the default tags to be rendered as HTML, even in HTML code, set the code block’s “markup” attribute to “default”.