码迷,mamicode.com
首页 > 其他好文 > 详细

SyntaxHighlighter 代码高亮极简单配置

时间:2019-01-09 00:31:26      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:turn   har   nta   代码高亮   asc   style   css   csharp   autoload   

页首Html代码:

<!--<link type="text/css" rel="stylesheet" href="https://blog-static.cnblogs.com/files/WNpursue/shCoreRDark.css"/>-->
<script type="text/javascript" src="https://blog-static.cnblogs.com/files/WNpursue/shCore.js"></script>
<script type="text/javascript" src="https://blog-static.cnblogs.com/files/WNpursue/shAutoloader.js"></script>
<script type="text/javascript" src="https://blog-static.cnblogs.com/files/WNpursue/shBrushCSharp.js"></script>
<script type="text/javascript" src="https://blog-static.cnblogs.com/files/WNpursue/shBrushCss.js"></script>
<script type="text/javascript" src="https://blog-static.cnblogs.com/files/WNpursue/shBrushJScript.js"></script>
<!--代码高亮-->

页脚Html代码:

<script type="text/javascript">
    SyntaxHighlighter.all(); //代码高亮
  </script>

所有插入代码放入对应便签中 以下中:(所有 ‘<‘ 都用VSCode 替换成 ‘&lt;’  否则 <script>等片段会被浏览器识别成标签)

(CSharp =>C#,  Css => css , JScript => javascript )
<div class="Highlighter">
<pre class="brush:javascript;gutter:true;">
     SyntaxHighlighter.all(); //代码高亮这一步需要放在最后
<pre>
</div>
<div class="Highlighter">
<pre class="brush:csharp;gutter:true;">
public String Get()
{
    var a = "Hello World";
    return a;
}
<pre>
</div>
<div class="Highlighter">
<pre class="brush:css;gutter:true;">
.css{
   css:css,
   css:css,
}
<pre>
</div>

SyntaxHighlighter 代码高亮极简单配置

标签:turn   har   nta   代码高亮   asc   style   css   csharp   autoload   

原文地址:https://www.cnblogs.com/WNpursue/p/10242061.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!