admin管理员组文章数量:1277271
I cant seem to highlight html with prism.js because it removes the markup just printing the text. the following code inside the "pre" tag shows as just the text. I have the class for the "code" tag set to "language-markup".
<table class="data-table">
<tr>
<td>Title</td>
<td>Amount</td>
</tr>
<tr>
<td>Shorts</td>
<td>£1.00</td>
</tr>
<tr>
<td>Shorts</td>
<td>£1.00</td>
</tr>
</table>
shows as
Title
Amount
Shorts
£1.00
Shorts
£1.00
I cant seem to highlight html with prism.js because it removes the markup just printing the text. the following code inside the "pre" tag shows as just the text. I have the class for the "code" tag set to "language-markup".
<table class="data-table">
<tr>
<td>Title</td>
<td>Amount</td>
</tr>
<tr>
<td>Shorts</td>
<td>£1.00</td>
</tr>
<tr>
<td>Shorts</td>
<td>£1.00</td>
</tr>
</table>
shows as
Title
Amount
Shorts
£1.00
Shorts
£1.00
Share
Improve this question
asked Apr 23, 2014 at 12:05
wazzadaywazzaday
9,6646 gold badges44 silver badges69 bronze badges
1
- possible duplicate of Prism HTML highlighter – Nathan Jones Commented Nov 20, 2014 at 19:40
2 Answers
Reset to default 8You need to escape the beginning of the tags with <
. The easiest way is to paste your html code into the pre tag, then perform a find and replace for all <
characters.
This should work:
<table class="data-table">
<tr>
<td>Title</td>
<td>Amount</td>
</tr>
<tr>
<td>Shorts</td>
<td>£1.00</td>
</tr>
<tr>
<td>Shorts</td>
<td>£1.00</td>
</tr>
</table>
In alternative you can wrap your code with <script type="prism-html-markup"> your code </script>
本文标签: javascripthighlighting html with prismjsStack Overflow
版权声明:本文标题:javascript - highlighting html with prism.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741293050a2370658.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论