Angle brackets in WordPress

Writing my first post (that now will be the second) I had troubles with angle brackets in source code.
So, lets look at different ways of source code insertion and.
As a test case, use a prase

Any XSLT contains <xsl:stylesheet> or &lt;xsl:transform&gt; with <xsl:template> inside element

enclosing highlighted text to all possible code tags.

[code]
Any XSLT

contains <xsl:stylesheet> or &lt;xsl:transform&gt; with <xsl:template>

element

Triple quotes ```
Any XSLT

contains <xsl:stylesheet> or <xsl:transform> with <xsl:template>

element

<pre>
Any XSLT

contains  or <xsl:transform> with <xsl:template>

element

<code>
Any XSLT contains or <xsl:transform> with <xsl:template> element

Single quotes `
Any XSLT contains or &lt;xsl:transform&gt; with <xsl:template> element

Summarize results in the next table:

<x> &lt;x&gt; &#60;x&#62;
[code] <x> &lt;x&gt; <x>
``` <x> <x> <x>
<pre> <x> <x>
<code> <x> <x>
` &lt;x&gt; <x>

So, the shortcode [code] is the most usefull for code blocks with angle brackets. As for inline case, we may use <code> with angle brackets or signle quotes with char codes.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s