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.
<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? Why do I need to add some character before the <div
for it to work? 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.
You may want to take a look at the HTML5 code tag :
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.