How to add code blocks in your posts

Hi

I am going to give a guideline to the authors about including code blocks in their posts like code blocks of HTML.

If you want to fine-tune how treats your code, use the allow and lang attributes on the code tag to specify how Code Markup should handle it.

  • <strong><code /></strong>or <strong><code /></strong>allows common HTML tags to be rendered, and displays everything else exactly as written.
      <li><code><strong><code /></strong>displays content exactly as written — no markup allowed.
      <li><code><strong><code /></strong>renders content as HTML — all markup is allowed.
      <li><code><strong><code /></strong>allows only <code /><em>, <code /><strong>and <code />tags to be rendered as HTML — everything else is displayed exactly as written. You can put whatever tags you like in the <code>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" /><strong><em>or
    </em></strong>
    <code lang="xhtml" /><strong><em>displays content exactly as written, the same as </em></strong><code /><strong><em>.</em></strong><strong><em>The <code>allow attribute overrides the lang attribute.

     

    Examples

    Example: Test strings using aString < "foo".
    Display: Test strings using aString < "foo".

    Example:

    
    <pre><code lang="xhtml"><!-- paragraph -->     What's going on?  

    Display:

    <!-- paragraph -->     What's going on?  

    Example:

    
    <pre><code><!-- paragraph -->     What's going on?  

    Display:

    <!-- paragraph -->     What's going on?  

    Example:

    
    <pre><code> for (int i=0; i&lt;5; ++i) {    <span style="color: red">cout</span> < < "smap!" << endl; } 

    Display:

    for (int i=0; i&lt;5; ++i) {    <span style="color: red">cout</span> < < "smap!" << endl; }

    Example:

    
    <pre><code> <a href="http://fastcreators.com/article/<span%20style=">target-url">Link text
    <p />Display:
    <pre class="code"><code><a href="http://fastcreators.com/article/<span%20style=">target-url">Link text</a>

    I thank Bennet for providing this awesome plugin.

    Regards,

    Haroon (www.fastcreators.com)

Post a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word