您的位置:首页 > Web前端 > HTML

markdown里如何显示HTML标签和转义字符

2016-09-02 16:33 295 查看


结论:用转义字符

例1:想在页面显示<br>

代码为:
<code class="hljs perl has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">&<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">lt</span>;br&<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">gt</span>;</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>


将<和>分别写成了转义字符的形式。

常用转义字符表为:
显示结果描述实体名称实体编号
 空格  
<小于号<<
>大于号>>
&和号&&
引号""
撇号'(IE不支持)'
例2:想显示转义字符:<

代码为:
<code class="hljs bash has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">&<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#60;</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>


将&写成了转义字符的形式。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  markdown