# CTAN Markdown: Code Blocks

Code blocks are rendered as is. Escaping is not in effect in code blocks. All characters are translated to render as the original character.

## Indented Code Blocks

Lines indented by four spaces or one TAB are treated as code blocks.

Example:

\def\abc{ABC}

And now the explanation...  

Example:

\def\abc{ABC}

And now the explanation...

## Fenced Code Blocks

Fenced code blocks are enclosed in triple backticks.

Example:


\def\abc{ABC}


And now the explanation...  

Example:

  \def\abc{ABC}

And now the explanation...

## Syntax Highlighting

To a certain extent some constructions of certain languages are known. Those constructions can be highlighted. The only thing you have to do is to specify the language in the initial backtick line:

Example:

 TeX
\def\abc{ABC}


Example:

  \def\abc{ABC}

And another example:

 sh
cd publications/2020
latex my-paper
bibtex my-paper
latex my-paper


And another example:

  cd publications/2020
latex my-paper
bibtex my-paper
latex my-paper


The following languages are recognized:

 bash C C++ csh ConTeXt Java JavaScript LaTeX plainTeX sh TeX XML 

You can specify the language as given above. Nevertheless the specification of the languages is treated case-insensitive. Thus TeX and tex denote the same.

If you specify any language which is not known then no syntax highlighting is applied.

The languages are not parsed with all details. A rough approximation is used which guarantees that proper input is rendered nicely. Illegal code is also treated – somehow.

## CTAN Markdown Tester

The result of the markdown can interactively be tested with our

Markdown Tester