CTAN
Comprehensive TeX Archive Network

CTAN Mark­down: Code Blocks

Code blocks are ren­dered as is. Es­cap­ing is not in ef­fect in code blocks. All char­ac­ters are trans­lated to ren­der as the orig­i­nal char­ac­ter.

In­dented Code Blocks

Lines in­dented by four spaces or one TAB are treated as code blocks.

Example:
  
    \def\abc{ABC}

And now the explanation...  

Ex­am­ple:

\def\abc{ABC}

And now the ex­pla­na­tion...

Fenced Code Blocks

Fenced code blocks are en­closed in triple back­ticks.

Example:

```  
  \def\abc{ABC}
```

And now the explanation...  

Ex­am­ple:

  \def\abc{ABC}

And now the ex­pla­na­tion...

Syn­tax High­light­ing

To a cer­tain ex­tend some con­struc­tions of cer­tain lan­guages are known. Those con­struc­tions can be high­lighted. The only thing you have to do is to spec­ify the lan­guage in the ini­tial back­tick line:

Example:

``` TeX 
  \def\abc{ABC}
```

Ex­am­ple:

  \def\abc{ABC}

The fol­low­ing lan­guages are rec­og­nized:

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

You can spec­ify the lan­guage as given above. Nev­er­the­less the spec­i­fi­ca­tion of the lan­guages is treated case-in­sen­si­tive. Thus TeX and tex de­note the same.

If you spec­ify any lan­guage which is not known then no syn­tax high­light­ing is ap­plied.

The lan­guages are not parsed with all de­tails. A rough ap­prox­i­ma­tion is used which guar­an­tees that proper in­put is ren­dered nicely. Il­le­gal code is also treated – some­how.

CTAN Mark­down

CTAN Mark­down Tester

The re­sult of the mark­down can in­ter­ac­tively be tested with our

Mark­down Tester
Guest Book Sitemap Contact Contact Author