Hexo代码高亮

程序员博客会经常贴代码,而直接用tab或者``来复制代码是不会显示高亮的,查了一下hexo官网,hexo对这个问题也有解决方案:

示例

public class MainActivity extends AppCompatActivity {

    @Override
    public void onCreate() {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

具体高亮是什么颜色还是要看你的主题了。

常用语言对应表

语言 对应代码
Bash bash, sh, zsh
C# cs, csharp
C++ cpp, c, cc, h, c++, h++, hpp
CSS css
DOS dos, bat, cmd
HTML, XML xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist
JSON json
Java java, jsp
JavaScript javascript, js, jsx
Objective C objectivec, mm, objc, obj-c
PHP php, php3, php4, php5, php6
Ruby ruby, rb, gemspec, podspec, thor, irb
SQL sql
Swift swift
VB.Net vbnet, vb

所有语言对应表

语言 对应代码
Zephir Zephir
XQuery xpath, xq
1C 1c
Access logs accesslog
ARM assembler armasm, arm
AVR assembler avrasm
ActionScript actionscript, as
Apache apache, apacheconf
AppleScript applescript, osascript
AsciiDoc asciidoc, adoc
AspectJ aspectj
AutoHotkey autohotkey
AutoIt autoit
Axapta axapta
Bash bash, sh, zsh
Basic basic
Brainfuck brainfuck, bf
C# cs, csharp
C++ cpp, c, cc, h, c++, h++, hpp
C/AL cal
Cache Object Script cos, cls
CMake cmake, cmake.in
CSP csp
CSS css
Cap’n Proto capnproto, capnp
Clojure clojure, clj
CoffeeScript coffeescript, coffee, cson, iced
Crmsh crmsh, crm, pcmk
Crystal crystal, cr
D d
DNS Zone file dns, zone, bind
DOS dos, bat, cmd
Dart dart
Delphi delphi, dpr, dfm, pas, pascal, freepascal, lazarus, lpr, lfm
Diff diff, patch
Django django, jinja
Dockerfile dockerfile, docker
DTS (Device Tree) dts
Dust dust, dst
Elixir elixir
Elm elm
Erlang erlang, erl
F# fsharp, fs
FIX fix
Fortran fortran, f90, f95
G-Code gcode, nc
Gams gams, gms
GAUSS gauss, gss
Gherkin gherkin
Go go, golang
Golo golo, gololang
Gradle gradle
Groovy groovy
HTML, XML xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist
HTTP http, https
Haml haml
Handlebars handlebars, hbs, html.hbs, html.handlebars
Haskell haskell, hs
Haxe haxe, hx
Ini ini
Inform7 inform7, i7
IRPF90 irpf90
JSON json
Java java, jsp
JavaScript javascript, js, jsx
Lasso lasso, ls, lassoscript
Less less
Lisp lisp
LiveCode Server livecodeserver
LiveScript livescript, ls
Lua lua
Makefile makefile, mk, mak
Markdown markdown, md, mkdown, mkd
Mathematica mathematica, mma
Matlab matlab
Maxima maxima
Maya Embedded Language mel
Mercury mercury
Mizar mizar
Mojolicious mojolicious
Monkey monkey
Moonscript moonscript, moon
NSIS nsis
Nginx nginx, nginxconf
Nimrod nimrod, nim
Nix nix
OCaml ocaml, ml
Objective C objectivec, mm, objc, obj-c
OpenGL Shading Language glsl
OpenSCAD openscad, scad
Oracle Rules Language ruleslanguage
Oxygene oxygene
PF pf, pf.conf
PHP php, php3, php4, php5, php6
Parser3 parser3
Perl perl, pl, pm
PowerShell powershell, ps
Processing processing
Prolog prolog
Protocol Buffers protobuf
Puppet puppet, pp
Python python, py, gyp
Q k, kdb
QML qml
R r
RenderMan RIB rib
RenderMan RSL rsl
Roboconf graph, instances
Ruby ruby, rb, gemspec, podspec, thor, irb
Rust rust, rs
SCSS scss
SQL sql
STEP Part 21 p21, step, stp
Scala scala
Scheme scheme
Scilab scilab, sci
Smali smali
Smalltalk smalltalk, st
Stan stan
Stata stata
Stylus stylus, styl
Swift swift
Tcl tcl, tk
TeX tex
Thrift thrift
TP tp
Twig twig, craftcms
TypeScript typescript, ts
VB.Net vbnet, vb
VBScript vbscript, vbs
VHDL vhdl
Vala vala
Verilog verilog, v
Vim Script vim
x86 Assembly x86asm
XL xl, tao
XQuery xpath, xq
Zephir zephir, zep
我来评几句
登录后评论

已发表评论数()

相关站点

热门文章