Sometimes, programming blogs or repositories such as GitHub and bitbucket need to display programming code to preview code and with nice color formatting styles.

code can be Java,json, CSS or HTML, or Python.

Markdown code fenced blocks

Markdown has support for code fence blocks as part of the native build.

Code block always starts with three backticks ````code type in a new line end with three backticks in a new line.

Here is an example of code block syntax

```java
This is an example of markdown code fence blocks.
\```

example

java is an optional language name and is used to highlight code syntax colors for a given code.

Markdown only supports code fence blocks but does no support code type natively.

Many engines such as GitHub and bitbucket supports code type for beautiful syntax color highlight. Here is an example code fence block


\```

example markdown code fenced blocks.

\```

Renders on the web page

example markdown code fenced blocks.

It generates the following HTML

<div class="highlight">
    <pre tabindex="0" class="chroma">
        <code class="language-fallback" data-lang="fallback">
            example markdown code fence blocks.
        </code>
    </pre>
</div>

Write syntax highlight code in Markdown

Codetype is used to highlight the source code with formatting and syntax colors.

It supports the following code languages.

codetypeLanguage
javascript,ECMAScript,js,jsx, nodejavascript
htmlhtml
console, shellShell programming
bash,sh,zshbash commands programming
dos,cmd,batDOS commands and programming
ps, powershellpowershell commands programming
propertiesproperties files
pythonpython language
xmlxml,xslt
jsonjson content
yaml,ymlyaml content
tomltoml
phpphp code
csC#, .net code
rs,rustRust programming code
swiftSwift programming
ts,typescriptTypescript program code
scalaScala
jsxReact
RR programming
objectivec,objcObjective C
luaLua
julia,jlJulia
ocaml,mlOCaml
pl,perlPerl

Example for display C# code in markdown


``` cs
Console.WriteLine("Markdown fenced code example");
\```

Render on page

Console.WriteLine("Markdown fenced code example");

Generates html

<code class="language-cs" data-lang="cs">
    <span class="n">Console</span>
    <span class="p">.</span>
    <span class="n">WriteLine</span>
    <span class="p">(</span>
        <span class="s">
            "Markdown fenced code example"
            </span>
        <span class="p">);</span>
</code>