[英]Html code block for html snippet?
This has to be the most frustrating thing ever lol. 这一定是有史以来最令人沮丧的事情。
I am using prettify.js to give the code syntax color, but with prettify.js or prism.js when I encode the html I have to write it like below with a period before .<
, otherwise my syntax is messed up with # tags. 我正在使用prettify.js来提供代码语法的颜色,但是在对html进行编码时,使用prettify.js或prism.js时,我必须像下面这样写,前加一个句点
.<
。
<pre class="prettyprint">.<div class="modal modal--medium modal--middle">
<div class="center-module">
<input type="text" placeholder="email">
<button class="button button--primary">send</button>
</div>
</div></pre>
With a period the above shows 以上期间显示
.<div class="modal modal--medium modal--middle">
<div class="center-module">
<input type="text" placeholder="email">
<button class="button button--primary">send</button>
</div>
</div>
Without a period before <
之前没有
<
#<DIV class="modal modal--medium modal--middle"#>
#<DIV class="center-module"#>
#<INPUT type="text" placeholder="email"#>
#<BUTTON class="button button--primary"#>send#</BUTTON>
#</DIV#>
#</DIV#>
My question is how/why is the <div
being wrapped with .tag
<span class="tag"><div</span>
by prettify.js? 我的问题是为什么prettify.js将
<div
用.tag
<span class="tag"><div</span>
包装? Why do I need to add some character before the <div
for it to work? 为什么我需要在
<div
之前添加一些字符才能使其正常工作? Any ideas why it is doing this? 有什么想法为什么要这样做吗?
FYI any character before the <div
will show the block just fine, but without a character when the &lr;div
is wrapped by the <pre></pre>
tags it shows a block with # tags. 仅供参考,
<div
之前的任何字符都可以很好地显示该块,但是当&lr;div
由<pre></pre>
标记包装时,没有任何字符,它将显示带有#标记的块。
You may want to take a look at the HTML5 code tag : 您可能需要看一下HTML5代码标签 :
<code>
<DIV class="modal modal--medium modal--middle">
<DIV class="center-module">
<INPUT type="text" placeholder="email">
<BUTTON class="button button--primary">send</BUTTON>
</DIV>
</DIV>
</code>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.