Syntax highlighter

Adds syntax highlighting to a range of source code languages. Note that this will not indent the code.

Input: TextResult: HTML with a sandboxed preview

Text input

Tool options

Examples

Highlight a JSON problem response

Input

{"type":"about:blank","title":"Not Found","status":404}

Expected answer

<span class="hljs-punctuation">{</span><span class="hljs-attr">&quot;type&quot;</span><span class="hljs-punctuation">:</span><span class="hljs-string">&quot;about:blank&quot;</span><span class="hljs-punctuation">,</span><span class="hljs-attr">&quot;title&quot;</span><span class="hljs-punctuation">:</span><span class="hljs-string">&quot;Not Found&quot;</span><span class="hljs-punctuation">,</span><span class="hljs-attr">&quot;status&quot;</span><span class="hljs-punctuation">:</span><span class="hljs-number">404</span><span class="hljs-punctuation">}</span>
Language
json
Highlight a parameterized SQL lookup

Input

SELECT name FROM planets WHERE moons > 1;

Expected answer

<span class="hljs-keyword">SELECT</span> name <span class="hljs-keyword">FROM</span> planets <span class="hljs-keyword">WHERE</span> moons <span class="hljs-operator">&gt;</span> <span class="hljs-number">1</span>;
Language
sql
Highlight a Python list comprehension

Input

squares = [n * n for n in range(5)]

Expected answer

squares = [n * n <span class="hljs-keyword">for</span> n <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">5</span>)]
Language
python
Highlight a shell command without running it

Input

curl --head https://example.org

Expected answer

curl --<span class="hljs-built_in">head</span> https://example.org
Language
bash
Highlight an HTTP response header block

Input

a398dfe7caef49e1ebb4c273.bin

76 bytes

Download

Expected answer

<span class="hljs-meta">HTTP/1.1</span> <span class="hljs-number">200</span> OK
<span class="hljs-attribute">Content-Type</span><span class="hljs-punctuation">: </span>application/json
<span class="hljs-attribute">Cache-Control</span><span class="hljs-punctuation">: </span>no-store

Language
http

Use one of the 'Beautify' operations for that.

Format reference: Syntax highlighter background and specification

Parameters

ParameterDefault valueInput and choices
Languageauto detectText
194 Available choices
  • auto detect
  • 1c
  • abnf
  • accesslog
  • actionscript
  • ada
  • angelscript
  • apache
  • applescript
  • arcade
  • arduino
  • armasm
  • xml
  • asciidoc
  • aspectj
  • autohotkey
  • autoit
  • avrasm
  • awk
  • axapta
  • bash
  • basic
  • bnf
  • brainfuck
  • c
  • cal
  • capnproto
  • ceylon
  • clean
  • clojure
  • clojure-repl
  • cmake
  • coffeescript
  • coq
  • cos
  • cpp
  • crmsh
  • crystal
  • csharp
  • 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
  • freedesktop
  • fsharp
  • gams
  • gauss
  • gcode
  • gherkin
  • glsl
  • gml
  • go
  • golo
  • gradle
  • graphql
  • groovy
  • haml
  • handlebars
  • haskell
  • haxe
  • hsp
  • http
  • hy
  • inform7
  • ini
  • irpf90
  • isbl
  • java
  • javascript
  • jboss-cli
  • json
  • julia
  • julia-repl
  • kotlin
  • lasso
  • latex
  • ldif
  • leaf
  • less
  • lisp
  • livecodeserver
  • livescript
  • llvm
  • lsl
  • lua
  • makefile
  • mathematica
  • matlab
  • maxima
  • mel
  • mercury
  • mipsasm
  • mizar
  • perl
  • mojolicious
  • monkey
  • moonscript
  • n1ql
  • nestedtext
  • nginx
  • nim
  • nix
  • node-repl
  • nsis
  • objectivec
  • ocaml
  • openscad
  • oxygene
  • parser3
  • pf
  • pgsql
  • php
  • php-template
  • plaintext
  • pony
  • powershell
  • processing
  • profile
  • prolog
  • properties
  • protobuf
  • puppet
  • purebasic
  • python
  • python-repl
  • q
  • qml
  • r
  • reasonml
  • rib
  • roboconf
  • routeros
  • rsl
  • ruleslanguage
  • rust
  • sas
  • scala
  • scheme
  • scilab
  • scss
  • shell
  • smali
  • smalltalk
  • sml
  • sqf
  • sql
  • stan
  • stata
  • step21
  • stylus
  • subunit
  • swift
  • taggerscript
  • yaml
  • tap
  • tcl
  • thrift
  • tp
  • twig
  • typescript
  • vala
  • vbnet
  • vbscript
  • vbscript-html
  • verilog
  • vhdl
  • vim
  • wasm
  • wren
  • x86asm
  • xl
  • xquery
  • zephir

Related tools

Browse code tidy tools