Files
mes-ui-d2/docs/zh/sys-components/highlight.md
liyang fa188248a8 主题和样式列表
Former-commit-id: f2b3aa42e49cefddec951da28fdd62a8abd57252 [formerly f2b3aa42e49cefddec951da28fdd62a8abd57252 [formerly f2b3aa42e49cefddec951da28fdd62a8abd57252 [formerly f2b3aa42e49cefddec951da28fdd62a8abd57252 [formerly e519d37e03f413d3448f570e5623d741c9c2b799 [formerly e027ce9365ce5d75551207ff00b1e1db4b143776]]]]]
Former-commit-id: af100daf4caaa6ff017a20a4bec64121f664bc4f
Former-commit-id: 2aebe4129d512df20ace3734d4bd5a63e6bdeb60
Former-commit-id: 4959c61e4827a4a320e25fa346b2e4ee93328c83 [formerly d43e81979c04e44fcc9188ff66da14f8f6b3452a]
Former-commit-id: 2769921855ed4794b496d5ed7ed65d29e40fb7a1
Former-commit-id: adbab21bd7025d95030bde43080c908a00c59481
Former-commit-id: 49029376b753c9222279fb958e59987111d25db0
Former-commit-id: 7995f51d5064ece339df7dbfba49074873e55b27
Former-commit-id: e1cd64740caa9bf662974b5e09a6a55ec1c83c96
2018-08-29 16:46:18 +08:00

3.6 KiB
Raw Blame History

d2-highlight

代码高亮显示组件

参数

参数名 介绍 必选 值类型 可选值 默认值
code 代码字符串 String
format-html 是否格式化 HTML Boolean false
lang 首选语言 String

::: tip format 建议只在内容为 HTML 的时候打开,如果内容不是 HTML设置为 true 会有负面效果 :::

示例

<d2-highlight code="alert('Hello')"/>

::: tip 本框架只是提供代码高亮的简单实现,如需实现更高级的设置请修改组件代码 :::

语言

如果不指定语言,默认会依次尝试以下语言:

  1. html
  2. javascript
  3. json
  4. css
  5. scss
  6. less

如果指定语言,将会首先尝试根据指定的语言解析。全部支持的语言:

  • 1c
  • abnf
  • accesslog
  • actionscript
  • ada
  • apache
  • applescript
  • cpp
  • arduino
  • armasm
  • xml
  • asciidoc
  • aspectj
  • autohotkey
  • autoit
  • avrasm
  • awk
  • axapta
  • bash
  • basic
  • bnf
  • brainfuck
  • cal
  • capnproto
  • ceylon
  • clean
  • clojure
  • clojure-repl
  • cmake
  • coffeescript
  • coq
  • cos
  • crmsh
  • crystal
  • cs
  • csp
  • css
  • d
  • markdown
  • dart
  • delphi
  • diff
  • django
  • dns
  • dockerfile
  • dos
  • dsconfig
  • dts
  • dust
  • ebnf
  • elixir
  • elm
  • ruby
  • erb
  • erlang-repl
  • erlang
  • excel
  • fix
  • flix
  • fortran
  • fsharp
  • gams
  • gauss
  • gcode
  • gherkin
  • glsl
  • go
  • golo
  • gradle
  • groovy
  • haml
  • handlebars
  • haskell
  • haxe
  • hsp
  • htmlbars
  • http
  • hy
  • inform7
  • ini
  • irpf90
  • java
  • javascript
  • jboss-cli
  • json
  • julia
  • julia-repl
  • kotlin
  • lasso
  • ldif
  • leaf
  • less
  • lisp
  • livecodeserver
  • livescript
  • llvm
  • lsl
  • lua
  • makefile
  • mathematica
  • matlab
  • maxima
  • mel
  • mercury
  • mipsasm
  • mizar
  • perl
  • mojolicious
  • monkey
  • moonscript
  • n1ql
  • nginx
  • nimrod
  • nix
  • nsis
  • objectivec
  • ocaml
  • openscad
  • oxygene
  • parser3
  • pf
  • php
  • pony
  • powershell
  • processing
  • profile
  • prolog
  • protobuf
  • puppet
  • purebasic
  • python
  • q
  • qml
  • r
  • rib
  • roboconf
  • routeros
  • rsl
  • ruleslanguage
  • rust
  • scala
  • scheme
  • scilab
  • scss
  • shell
  • smali
  • smalltalk
  • sml
  • sqf
  • sql
  • stan
  • stata
  • step21
  • stylus
  • subunit
  • swift
  • taggerscript
  • yaml
  • tap
  • tcl
  • tex
  • thrift
  • tp
  • twig
  • typescript
  • vala
  • vbnet
  • vbscript
  • vbscript-html
  • verilog
  • vhdl
  • vim
  • x86asm
  • xl
  • xquery
  • zephir

主题

  • agate
  • androidstudio
  • arduino-light
  • arta
  • ascetic
  • atelier-cave-dark
  • atelier-cave-light
  • atelier-dune-dark
  • atelier-dune-light
  • atelier-estuary-dark
  • atelier-estuary-light
  • atelier-forest-dark
  • atelier-forest-light
  • atelier-heath-dark
  • atelier-heath-light
  • atelier-lakeside-dark
  • atelier-lakeside-light
  • atelier-plateau-dark
  • atelier-plateau-light
  • atelier-savanna-dark
  • atelier-savanna-light
  • atelier-seaside-dark
  • atelier-seaside-light
  • atelier-sulphurpool-dark
  • atelier-sulphurpool-light
  • atom-one-dark
  • atom-one-light
  • brown-paper
  • brown-papersq.png
  • codepen-embed
  • color-brewer
  • darcula
  • dark
  • darkula
  • default
  • docco
  • dracula
  • far
  • foundation
  • github-gist
  • github
  • googlecode
  • grayscale
  • gruvbox-dark
  • gruvbox-light
  • hopscotch
  • hybrid
  • idea
  • ir-black
  • kimbie.dark
  • kimbie.light
  • magula
  • mono-blue
  • monokai-sublime
  • monokai
  • obsidian
  • ocean
  • paraiso-dark
  • paraiso-light
  • pojoaque
  • pojoaque.jpg
  • purebasic
  • qtcreator_dark
  • qtcreator_light
  • railscasts
  • rainbow
  • routeros
  • school-book
  • school-book.png
  • solarized-dark
  • solarized-light
  • sunburst
  • tomorrow-night-blue
  • tomorrow-night-bright
  • tomorrow-night-eighties
  • tomorrow-night
  • tomorrow
  • vs
  • vs2015
  • xcode
  • xt256
  • zenburn