Mini Tags And Plain Tags In Crayon


Warning: Mini Tags are depreciated in favour of <pre> tags. <pre> tags are backward compatible, html5 valid and usable in the new Tag Editor. If you have old blog posts that use Mini Tags, you can convert them automatically from the settings screen.

Writing $[php theme="twilight"]echo 123;[/php] turns into [crayon theme="twilight" lang="php"]echo 123;[/crayon]. No more do you need to retype the plugin’s charming name anymore – just the language and the settings you care about. If you want, you can turn this off in Settings (like everything else). Also, you can use <pre lang="php"></pre> if you’d like some backward compatibility with plugins that support this style of shortcode. Here’s an example of using Mini Tags and the output it generated. I’ve also added a new $[plain]...[/plain] tag that allows you to wrap any code in <pre><code> ... </code></pre> syntax for showing any syntax without using Crayon. It will also convert any nasty characters into HTML entities for you, so everything will look exactly as it does in the HTML view of the post editor. The IDs of the languages like “php” and “py” can be found in Settings > Crayon > Languages > Show Languages in WP admin.

  • http://www.blue-walrus.com oliver watkins

    any way you can remove the number column, and the grey shading (ie. have the option to remove it?)

    I am trying to find a syntaxhighlighter without the number column

    • Aram

      Yup, use [crayon-519bd9d61aca9-50f0c36052395 nums="false" striped="false" nums-toggle="false" ..... for individual Crayons, or just change them in Settings > Crayon in WP admin. Check out http://aramk.com/projects/crayon-syntax-highlighter/ for all the attributes. If you want them all to look the same, never mind the attribute overrides, just change the settings in WP.

      • http://www.JasonTheAdams.com Jason

        Hey! Your plugin is really impressive! An excellent showcase of the capabilities of regular expressions. I’ll definitely donate!

        I can’t find a way of setting a parameter to have the code always be plain text. I have a language I’ll probably use only once, and it’s not worth the effort adding. The user can select to view code as plain, but I can’t find anywhere to set it (and remove their ability to toggle it without hiding the whole toolbar). Thanks!

        • Aram

          Hey Jason, thanks for using Crayon! That’s a good idea, I’ll add this feature in the next version so you can choose either highlighted or plain as the default view, and of course there will be an attribute for individually setting this. I’ll also add the option to disable just plain code toggling. Thanks for requesting this, it appears I thought I’d add it but I guess I overlooked it.

        • Aram

          Ok, I’ve added the ability to disable plain code toggling and set plain code as the default view in 1.7.7. Let me know if it works for you too.

  • Pingback: Inline Tags & `Backquotes` In Crayon

  • Pingback: Crayon Syntax Highlighter | Best Plugins - wordpress – widgets – plugin 2012

  • Pingback: WP代码高亮插件 Crayon Syntax Highlighter | BccSafe's Blog

  • Pingback: Crayon Syntax Highlighter

  • Pingback: Crayon Syntax Highlighterでページ読み込み速度が遅くなる現象を改善する | mawatari.jp

  • ahmad

    salam aram jan… ahmad hastam az iran… age vaght dashti behem mail bezan kami sohbat konim rajebe seo va site…montazeram

    emaile man : mihandid@yahoo.com