highlight

pub

Syntax highlighter for Dart developers.

If you are looking for syntax highlight widget for Flutter, see flutter_highlight.

Usage

import 'package:highlight/highlight.dart' as highlight;

main() {
  var source = '''main() {
  print("Hello, World!");
}
''';

  // Parse source code and returns a highlight [Result] which contains relevance and tree nodes
  var result = highlight.parse(source, language: 'dart');

  // Output HTML string, which has highlight.js style class name, hljs-
  var html = result.toHtml();
  print(html);
}

References

License

MIT

Libraries

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