Articles in this section
Category / Section

How to Write Articles With Code Blocks

Published:

Why should I use code blocks

Use code blocks to highlight the codes across the entire article.

How to use the code blocks

To Insert code block on Markdown or WYSIWYG,

  1. Choose the Insert Code from the Markdown Editor toolbar.

insert Code Option in Markdown Editor

insert Code Option in WYSIWYG Editor

  1. By adding triple backticks “`” before and after the code block, you can create fenced code blocks.
  2. To make the raw formatting simpler to read, you can put a blank line before and after code sections.

How to change the highlighted language

You can add an optional language identifier to your code block to enable syntax highlighting in a different language.

Markdown

Editor

Code Snipet Result Markdown

WYSIWYG

Note: If you does not specify a language identifier, the auto highlight will be applied. Highlight styles will be applied based on the specified identifier.

Editor

code Snipet Result WYSIWYG

Supported highlight languages

Language Identifiers
1C 1c
ABNF abnf
Access logs accesslog
Ada ada
Arduino (C++ w/Arduino libs) arduino, ino
ARM assembler armasm, arm
AVR assembler avrasm
ActionScript actionscript, as
AngelScript angelscript, asc
Apache apache, apacheconf
AppleScript applescript, osascript
Arcade arcade
AsciiDoc asciidoc, adoc
AspectJ aspectj
AutoHotkey autohotkey
AutoIt autoit
Awk awk, mawk, nawk, gawk
Bash bash, sh, zsh
Basic basic
BNF bnf
Brainfuck brainfuck, bf
C# csharp, cs
C c, h
C++ cpp, hpp, cc, hh, c++, h++, cxx, hxx
C/AL cal
Cache Object Script cos, cls
CMake cmake, cmake. in
Coq coq
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
Dart dart
Delphi dpr, dfm, pas, pascal
Diff diff, patch
Django django, jinja
DNS Zone file dns, zone, bind
Dockerfile dockerfile, docker
DOS dos, bat, cmd
dsconfig dsconfig
DTS (Device Tree) dts
Dust dust, dst
EBNF ebnf
Elixir elixir
Elm elm
Erlang erlang, erl
Excel excel, xls, xlsx
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
GraphQL graphql
Groovy groovy
HTML, XML xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist, svg
HTTP http, https
Haml haml
Handlebars handlebars, hbs, html.hbs, html.handlebars
Haskell haskell, hs
Haxe haxe, hx
Hy hy, hylang
Ini, TOML ini, toml
Inform7 inform7, i7
IRPF90 irpf90
JSON json
Java java, jsp
JavaScript javascript, js, jsx
Julia julia, julia-repl
Kotlin kotlin, kt
LaTeX tex
Leaf leaf
Lasso lasso, ls, lassoscript
Less less
LDIF ldif
Lisp lisp
LiveCode Server livecodeserver
LiveScript livescript, ls
Lua lua
Makefile makefile, mk, mak, make
Markdown markdown, md, mkdown, mkd
Mathematica mathematica, mma, wl
Matlab matlab
Maxima maxima
Maya Embedded Language mel
Mercury mercury
Mizar mizar
Mojolicious mojolicious
Monkey monkey
Moonscript moonscript, moon
N1QL n1ql
NSIS nsis
Nginx nginx, nginxconf
Nim nim, nimrod
Nix nix
OCaml ocaml, ml
Objective C objectivec, mm, objc, obj-c, obj-c++, objective-c++
OpenGL Shading Language glsl
OpenSCAD openscad, scad
Oracle Rules Language ruleslanguage
Oxygene oxygene
PF pf, pf.conf
PHP php
Parser3 parser3
Perl perl, pl, pm
Plaintext plaintext, txt, text
Pony pony
PostgreSQL & PL/pgSQL pgsql, postgres, postgresql
PowerShell powershell, ps, ps1
Processing processing
Prolog prolog
Properties properties
Protocol Buffers protobuf
Puppet puppet, pp
Python python, py, gyp
Python profiler results profile
Python REPL python-repl, pycon
Q k, kdb
QML qml
R r
ReasonML reasonml, re
RenderMan RIB rib
RenderMan RSL rsl
Roboconf graph, instances
Ruby ruby, rb, gemspec, podspec, thor, irb
Rust rust, rs
SAS SAS, sas
SCSS scss
SQL sql
STEP Part 21 p21, step, stp
Scala scala
Scheme scheme
Scilab scilab, sci
Shell shell, console
Smali smali
Smalltalk smalltalk, st
SML sml, ml
Stan stan, stanfuncs
Stata stata
Stylus stylus, styl
SubUnit subunit
Swift swift
Tcl tcl, tk
Test Anything Protocol tap
Thrift thrift
TP tp
Twig twig, craftcms
TypeScript typescript, ts, tsx
VB.Net vbnet, vb
VBScript vbscript, vbs
VHDL vhdl
Vala vala
Verilog verilog, v
Vim Script vim
X++ axapta, x++
x86 Assembly x86asm
XL xl, tao
XQuery xquery, xpath, xq
YAML yml, yaml
Zephir zephir, zep
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied