Markdown(2)-代码高亮

前言

未来酷炫的显示技术博客的样子,怎么能缺少黑底白字的高亮代码呢?

开启功能

  1. 主题配置文件config.yaml.

    1
    highlight_theme: normal

    Next 默认有5款主题可供选择: normal , night , night blue , night bright , night eighties :

代码高亮

  1. 使用 ```来标记

    1
    2
    3
    \```language
    code snippet
    ```
  2. 代码块

    1
    2
    3
    {% codeblock [lang:language] [title] [url] [link text] %}
    code snippet
    {% endcodeblock %}

参考:https://www.zhihu.com/question/37052642)

支持的语言列表

名称 关键字 调用的js 说明
AppleScript applescript shBrushAppleScript.js
ActionScript 3.0 actionscript3 , as3 shBrushAS3.js
Shell bash , shell shBrushBash.js
ColdFusion coldfusion , cf shBrushColdFusion.js
C cpp , c shBrushCpp.js
C# c# , c-sharp , csharp shBrushCSharp.js
CSS css shBrushCss.js
Delphi delphi , pascal , pas shBrushDelphi.js
diff&patch diff patch shBrushDiff.js 用代码版本库时,遇到代码冲突,其语法就是这个.
Erlang erl , erlang shBrushErlang.js
Groovy groovy shBrushGroovy.js
Java java shBrushJava.js
JavaFX jfx , javafx shBrushJavaFX.js
JavaScript js , jscript , javascript shBrushJScript.js
Perl perl , pl , Perl shBrushPerl.js
PHP php shBrushPhp.js
text text , plain shBrushPlain.js 就是普通文本.
Python py , python shBrushPython.js
Ruby ruby , rails , ror , rb shBrushRuby.js
SASS&SCSS sass , scss shBrushSass.js
Scala scala shBrushScala.js
SQL sql shBrushSql.js
Visual Basic vb , vbnet shBrushVb.js
XML xml , xhtml , xslt , html shBrushXml.js
Objective C objc , obj-c shBrushObjectiveC.js
F# f# f-sharp , fsharp shBrushFSharp.js
xpp , dynamics-xpp shBrushDynamics.js
R r , s , splus shBrushR.js
matlab matlab shBrushMatlab.js
swift swift shBrushSwift.js
GO go , golang shBrushGo.js

参考

https://blog.csdn.net/gaoqiang0707/article/details/79946292