Adds syntax highlighting and snippet support for a wide variety of programming languages such as Clojure, Go, Jade, Lua, Swift, Ruby and many more. See the change log for changes and road map. Showing Perl, Stylus and Ruby. TextMate bundles. This extension uses Visual Studio's capability to load TextMate bundles. Lua Syntax Highlighting GUI. By borderlinedefective. Really out of date bad highlighting i stole from remote2script loong time ago to change highlighting colors, change the text color of the labels in EditorFrame.Source p.s. If you wanted to make this better, rewrite using richtext;) Type.
- Lua Syntax Checker
- Lua Syntax Highlighting Code
- Lua Syntax Highlighting Colors
- Lua Syntax Highlighting Codes
- Lua Syntax Highlighting Cheat
Hugo comes with really fast syntax highlighting from Chroma.
Lua Syntax Checker
Hugo uses Chroma as its code highlighter; it is built in Go and is really, really fast – and for the most important parts compatible with Pygments we used before.
Lua Syntax Highlighting Code
Configure Syntax Highlighter
See Configure Highlight.
Generate Syntax Highlighter CSS
If you run with
pygmentsUseClasses=true
in your site config, you need a style sheet.You can generate one with Hugo:
Run
hugo gen chromastyles -h
for more options. See https://xyproto.github.io/splash/docs/ for a gallery of available styles.Highlight Shortcode
Highlighting is carried out via the built-in
highlight
shortcode. It takes exactly one required parameter for the programming language to be highlighted and requires a closing shortcode. Note that highlight
is not used for client-side javascript highlighting.Options:
![Roblox lua syntax Roblox lua syntax](https://i.stack.imgur.com/CTaO5.png)
linenos
: configure line numbers. Valid values aretrue
,false
,table
, orinline
.false
will turn off line numbers if it’s configured to be on in site config.table
will give copy-and-paste friendly code blocks.hl_lines
: lists a set of line numbers or line number ranges to be highlighted.linenostart=199
: starts the line number count from 199.anchorlinenos
: Configure anchors on line numbers. Valid values aretrue
orfalse
;lineanchors
: Configure a prefix for the anchors on line numbers. Will be suffixed with-
, so linking to the line number 1 with the optionlineanchors=prefix
adds the anchorprefix-1
to the page.
Example: Highlight Shortcode
Gives this:
Highlight Template Func
See Highlight.
Highlighting in Code Fences
Highlighting in code fences is enabled by default.
Gives this:
Note that only Goldmark supports passing attributes such as
hl_lines
, and it’s important that it does not contain any spaces. See goldmark-highlighting for more information.The options are the same as in the highlighting shortcode,including
linenos=false
, but note the slightly different Markdown attribute syntax.List of Chroma Highlighting Languages
The full list of Chroma lexers and their aliases (which is the identifier used in the
highlight
template func or when doing highlighting in code fences):- ABAP
- ABAP, abap
- ABNF
- abnf
- AL
- al, dal
- ANTLR
- antlr
- APL
- apl
- ActionScript
- actionscript, as
- ActionScript 3
- actionscript3, as, as3
- Ada
- ada, ada2005, ada95, adb, ads
- Angular2
- ng2
- ApacheConf
- aconf, apache, apacheconf, conf, htaccess
- AppleScript
- applescript
- Arduino
- arduino, ino
- Awk
- awk, gawk, mawk, nawk
- BNF
- bnf
- Ballerina
- bal, ballerina
- Base Makefile
- *, bsdmake, mak, make, makefile, mf, mk
- Bash
- bash, bash_*, bashrc, ebuild, eclass, env, exheres-0, exlib, ksh, sh, shell, zsh, zshrc
- Batchfile
- bat, batch, cmd, dosbatch, winbatch
- BibTeX
- bib, bibtex
- BlitzBasic
- b3d, bb, blitzbasic, bplus, decls
- Brainfuck
- b, bf, brainfuck
- C
- c, h, idc
- C#
- c#, cs, csharp
- C++
- C, CPP, H, c++, cc, cp, cpp, cxx, h++, hh, hpp, hxx
- CFEngine3
- cf, cf3, cfengine3
- CMake
- cmake, txt
- COBOL
- COB, CPY, cob, cobol, cpy
- CSS
- css
- Caddyfile
- caddy, caddyfile
- Caddyfile Directives
- caddy-d, caddyfile-d, caddyfile-directives
- Cap'n Proto
- capnp
- Cassandra CQL
- cassandra, cql
- Ceylon
- ceylon
- ChaiScript
- chai, chaiscript
- Cheetah
- cheetah, spitfire, spt, tmpl
- Clojure
- clj, clojure
- CoffeeScript
- coffee, coffee-script, coffeescript
- Common Lisp
- cl, common-lisp, lisp
- Coq
- coq, v
- Crystal
- cr, crystal
- Cython
- cython, pxd, pxi, pyrex, pyx
- D
- d, di
- DTD
- dtd
- Dart
- dart
- Diff
- diff, patch, udiff
- Django/Jinja
- django, jinja
- Docker
- docker, dockerfile
- Dylan
- dyl, dylan, intr
- EBNF
- ebnf
- Elixir
- elixir, ex, exs
- Elm
- elm
- EmacsLisp
- el, elisp, emacs, emacs-lisp
- Erlang
- erl, erlang, es, escript, hrl
- FSharp
- fs, fsharp, fsi
- Factor
- factor
- Fish
- fish, fishshell, load
- Forth
- forth, frt, fs, fth
- Fortran
- F03, F90, f03, f90, fortran
- GAS
- S, asm, gas, s
- GDScript
- gd, gdscript
- GLSL
- frag, geo, glsl, vert
- Genshi
- genshi, kid, xml+genshi, xml+kid
- Genshi HTML
- html+genshi, html+kid
- Genshi Text
- genshitext
- Gherkin
- Cucumber, FEATURE, Gherkin, cucumber, feature, gherkin
- Gnuplot
- gnuplot, plot, plt
- Go
- go, golang
- Go HTML Template
- go-html-template
- Go Text Template
- go-text-template
- GraphQL
- gql, graphql, graphqls
- Groovy
- gradle, groovy
- HCL
- hcl
- HLB
- hlb
- HTML
- htm, html, xhtml, xslt
- HTTP
- http
- Handlebars
- handlebars, hbs
- Haskell
- haskell, hs
- Haxe
- haxe, hx, hxsl
- Hexdump
- hexdump
- Hy
- hy, hylang
- INI
- cfg, dosini, editorconfig, gitconfig, inf, ini
- Idris
- idr, idris
- Igor
- igor, igorpro, ipf
- Io
- io
- J
- ijs, j
- JSON
- json
- Java
- java
- JavaScript
- javascript, js, jsm, mjs
- Julia
- jl, julia
- Jungle
- jungle
- Kotlin
- kotlin, kt
- LLVM
- ll, llvm
- Lighttpd configuration file
- lighttpd, lighty
- Lua
- lua, wlua
- MLIR
- mlir
- Mako
- mako, mao
- Mason
- m, mason, mc, mhtml, mi
- Mathematica
- cdf, ma, mathematica, mma, nb, nbp
- Matlab
- m, matlab
- MiniZinc
- MZN, dzn, fzn, minizinc, mzn
- Modula-2
- def, m2, mod, modula2
- MonkeyC
- mc, monkeyc
- MorrowindScript
- morrowind, mwscript
- MySQL
- mysql, sql
- Myghty
- myghty, myt
- NASM
- ASM, asm, nasm
- Newspeak
- newspeak, ns2
- Nginx configuration file
- conf, nginx
- Nim
- nim, nimrod
- Nix
- nix, nixos
- OCaml
- ml, mli, mll, mly, ocaml
- Objective-C
- h, m, obj-c, objc, objective-c, objectivec
- Octave
- m, octave
- OpenSCAD
- openscad, scad
- Org Mode
- org, orgmode
- PHP
- inc, php, php3, php4, php5, php[345]
- PHTML
- phtml
- PL/pgSQL
- plpgsql
- POVRay
- inc, pov
- PacmanConf
- conf, pacmanconf
- Perl
- perl, pl, pm, t
- Pig
- pig
- PkgConfig
- pc, pkgconfig
- Pony
- pony
- PostScript
- eps, postscr, postscript, ps
- PostgreSQL SQL dialect
- postgres, postgresql
- PowerShell
- posh, powershell, ps1, psd1, psm1
- Prolog
- ecl, pl, pro, prolog
- PromQL
- promql
- Protocol Buffer
- proto, protobuf
- Puppet
- pp, puppet
- Python
- py, python, pyw, sage, sc, tac
- Python 3
- py3, python3
- QBasic
- BAS, bas, basic, qbasic
- QML
- qbs, qml
- R
- R, Renviron, Rhistory, Rprofile, S, r, s, splus
- Racket
- racket, rkt, rktd, rktl
- Ragel
- ragel
- ReasonML
- re, reason, reasonml, rei
- Rexx
- arexx, rex, rexx, rx
- Ruby
- duby, gemspec, rake, rb, rbw, rbx, ruby
- Rust
- in, rs, rust
- SAS
- SAS, sas
- SCSS
- scss
- SPARQL
- rq, sparql
- SQL
- sql
- SYSTEMD
- service, systemd
- Sass
- sass
- Scala
- scala
- Scheme
- scheme, scm, ss
- Scilab
- sce, sci, scilab, tst
- Smalltalk
- smalltalk, squeak, st
- Smarty
- smarty, tpl
- Snobol
- snobol
- Solidity
- sol, solidity
- SquidConf
- conf, squid, squid.conf, squidconf
- Standard ML
- fun, sig, sml
- Stylus
- styl, stylus
- Swift
- swift
- TASM
- ASM, asm, tasm
- TOML
- toml
- TableGen
- tablegen, td
- Tcl
- rvt, tcl
- Tcsh
- csh, tcsh
- TeX
- aux, latex, tex, toc
- Termcap
- src, termcap
- Terminfo
- src, terminfo
- Terraform
- terraform, tf
- Thrift
- thrift
- TradingView
- tradingview, tv
- Transact-SQL
- t-sql, tsql
- Turing
- tu, turing
- Turtle
- ttl, turtle
- Twig
- twig
- TypeScript
- ts, tsx, typescript
- TypoScript
- ts, typoscript
- TypoScriptCssData
- typoscriptcssdata
- TypoScriptHtmlData
- typoscripthtmldata
- VB.net
- bas, vb, vb.net, vbnet
- VHDL
- vhd, vhdl
- VimL
- exrc, gvimrc, vim, vimrc
- WDTE
- wdte
- XML
- rss, svg, wsdl, wsf, xml, xsd, xsl, xslt
- Xorg
- conf, xorg.conf
- YAML
- yaml, yml
- YANG
- yang
- Zig
- zig
- cfstatement
- cfs
- markdown
- markdown, md, mkd
- mcfunction
- mcfunction
- plaintext
- no-highlight, plain, text, txt
- reStructuredText
- rest, restructuredtext, rst
- react
- jsx, react
- reg
- reg, registry
- systemverilog
- sv, svh, systemverilog
- verilog
- v, verilog
- vue
- vue, vuejs
See Also
Lua Syntax Highlighting Colors
One potential source of errors in Lua programs is the unintended use of global variables. The
lua2-mode
Emacs mode aims to show how improved editors can help programmers to avoid these errors, without changing the Lua language itself. The Problem
When writing Lua code, it is all too easy to forget to declare a certain variable as local. In all likelihood, the program will still work as expected, but problems will occur if the affected code is called recursively or from co-routines. Another code fragment might mistakenly use the same global variable, too.
Traditional approaches for detecting unwanted global variables use separate tools external to the editor, typically based on bytecode scanning. Obvious advantage is editor independence and integration with build processes. The downside is a lack of immediate feedback to programmers.
lua2-mode
is an experiment to see if such immediate feedback is helpful when writing Lua programs. Our Approach
When
lua2-mode
is loaded, global variable references are shown in bold. Assignments and bindings are underlined. Assignments to global variables are also shown in italics. You can change the appearance of variable references by customizing the
lua2-*
faces. If you drop the references to font-lock-variable-name-face
, globals stand out even more clearly, but this might be considered excessive. Bonus Features
If the point is at a reference to a local variable, pressing
C-c C-d
jumps to its definition. You can rename a local variable (and all its occurrences within its scope) by pressing C-c C-r
. Limitations
I wrote the parser by hand, and it is still not quite right. In particular, some invalid programs are accepted.
The current implementation is too slow for actually editing medium-sized files with it. It might be possible to improve its speed by switching to syntax tables instead of regular expressions for lexing.
Better editor support is possible if we execute Lua code in a sandbox and extract information from that. Microsoft has demonstrated the feasibility of this approach for Javascript (Scott Guthrie, JavaScript Intellisense Improvements with VS 2010, April 2010). We would have to embed a Lua interpreter into Emacs, but Emacs lacks a plug-in interface, so we would have to create a private fork for this purpose. For this reason, the current approach based on Emacs and a parser written in Emacs Lisp is a dead end.
Availability
lua2-mode
is free software, available on the GNU General Public License, version 2 or later. Lua Syntax Highlighting Codes
lua2-mode
has only been tested with GNU Emacs 23.1. It depends on lua-mode, which must also be installed. I recommend to byte-compile
lua2-mode
, in order to get somewhat better performance. Reporting problems
Please send problem reports to [email protected] and include the string
lua2-mode
in the subject line. Problem reports should include Lua source which exhibits the problem, and a short description what is going wrong. Please also indicate if I may put your source code into the test suite. Revisions
Lua Syntax Highlighting Cheat
- 2010-07-25: Version 0.1 published.
- 2011-10-09: Released version 0.2, using a bold, black face for global variable references, and fixing a bug in
for
scope handling.
Florian Weimer
HomeBlog (DE)Blog (EN)RSS FeedsImpressum
HomeBlog (DE)Blog (EN)RSS FeedsImpressum