Code Markup WordPress plugin version 1.1

My Code Markup WordPress plugin has been updated to version 1.1. Code Markup 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. This new version has a few nice new features:

Valid HTML

Code Markup no longer forces you to write invalid (X)HTML — it now strips the “allow” and “lang” attributes when displaying posts. The attributes are still there when you edit the posts, of course.

Explicitly specify allowed tags

You can now explicitly specify a set of allowed HTML tags in the “allow” attribute. For example, you can explicitly say that you want a and span tags to be allowed as normal HTML, but all other tags should be displayed exactly as you typed them.

HTML Comments

HTML comments are now allowed by default.

Download

For details and download, see the main Code Markup page.

Share This | Comments | Permalink | Trackback | Comments feed

8 comments

  • Edd says:

    Great plugin! Thanks for putting it together. I may have come across a bug, however. C++ code such as:

    #include <iostream>
    int main()
    {
    std::cout << “Hello, world!\n”;
    return 0;
    }

    comes out with the slash missing in the new-line character within the string literal. To work around this I’m having to put double \\. Single slashes seem to work outside of <pre><code> just fine.

    Edd

  • Bennett says:

    Thanks for that, Edd. Code Markup contains a workaround for a WordPress bug to do with backslashes — maybe the workaround doesn’t work in all cases. I will investigate.

  • Edd says:

    I’m currently working around the problem by doing an str_replace of each single slash with a double slash before the call to htmlspecialchars on line 117-ish.

    It’s probably not the ‘correct’ thing to do, but it’s a temporary fix for anyone else with the same problem.

    Edd

  • [...] O último ponto foi um factor de exclusão para a maioria dos plugins que encontrei. Acabei por utilizar o Code Markup que permite a inserção de código nos posts sem que este seja executado. O primeiro ponto estava ultrapassado. [...]

  • [...] Depois de, sem sucesso, procurar plugins para o <a href=”http://wordpress.org/” title=”Wordpress.org”>wordpress</a> (<a href=”http://codex.wordpress.org/Plugins” title=”Plugins Wordpress Codex”>aqui</a> e <a href=”http://wp-plugins.net/” title=”Wordpress Plugin Database”>aqui</a>), que “colorissem” o código inserido nos posts, resolvi deitar mãos à obra. Eis o que pretendia: <ul> <li>Inserir código (qualquer linguagem) nos posts sem que o mesmo seja executado;</li> <li>”Colorir” o código (<a href=”http://en.wikipedia.org/wiki/Syntax_highlighting” title=”entrada na Wikipédia”>syntax highlight</a>);</li> <li>Não adicionar elementos desnecessários ao código <acronym title=”Em Inglês: HyperText Markup Language”>HTML</acronym> da página apenas para motivos visuais;</li> </ul> O último ponto foi um factor de exclusão para a maioria dos plugins que encontrei. Acabei por utilizar o <a href=”http://www.thunderguy.com/semicolon/2006/02/05/code-markup-wordpress-plugin-version-11/” title=”visitar o site”>Code Markup</a> que permite a inserção de código nos posts sem que este seja executado. O primeiro ponto estava ultrapassado. [...]

  • sohbet says:

    turkiye en büyük sohbet odasi

Post a comment

(required)
(required)
(some HTML allowed; for literal < and &, use &lt; and &amp;)
Close
E-mail It