Advanced Formatting Documentation

Backslash Escapes

Markdown allows backslash escapes to be used to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax. For example, if you wanted to surround a word with literal asterisks (instead of an HTML <em> tag), backslashes before the asterisks can be used, like this:

\* literal asterisks\*

Which gives the result:

\* literal asterisks\*

Markdown provides backslash escapes for the following characters:

\   backslash
`   backtick
*   asterisk
_   underscore
{}  curly braces
[]  square brackets
()  parentheses
#   hash mark
+   plus sign
-   minus sign (hyphen)
.   dot
!   exclamation mark

The Markdown Extra variant supported by COBD Docs adds the following characters to the list of characters that can be escaped with a backslash:

:   colon
|.  pipe

Advanced Markdown Syntax

Code

Code Blocks

Code blocks are written by indenting lines by four spaces:

    Using <em>HTML</em> and using *Markdown*.
Inside a code block, you can write HTML tags or Markdown formatting; in both cases the syntax won’t be parsed and text will be shown as is:
Using <em>HTML</em> and using *Markdown*.

Inside a code block, you can write HTML tags or Markdown formatting; in both cases the syntax won’t be parsed and text will be shown as is:

Code Spans

Code spans can be made in the middle of paragraphs by using the backtick (`), this way:

Please don't use the `<blink>` tag.

Which will produce the following result:

Please don’t use the <blink> tag.

Fenced Code Blocks

The Markdown Extra variant used by COBD Docs introduces a syntax code block without indentation. Fenced code blocks are like Markdown’s regular code blocks, except that they’re not indented and instead rely on start and end fence lines to delimit the code block. The code block starts with a line containing three or more tilde ~ characters, and ends with the first line with the same number of tilde ~. For instance:

This is a paragraph introducing:

~~~~~~~~~~~~~~~~~~~~~
a one-line code block
~~~~~~~~~~~~~~~~~~~~~

Backticks ` characters can be used instead of tilde:

``````````````````
another code block
``````````````````

Contrary to their indented counterparts, fenced code blocks can begin and end with blank lines:

~~~

blank line before
blank line after

~~~

Indented code blocks cannot be used immediately following a list because the list indent takes precedence; fenced code block have no such limitation:

1.  List item

    Not an indented code block, but a second paragraph
    in the list item

~~~~
This is a code block, fenced-style
~~~~

Fenced code blocks are also ideal if you need to paste some code in an editor which doesn’t have a command for increasing the indent of a block of text, such as a text box in your web browser.

A class name that will apply to a code block can be specified. This is useful if code blocks must be styled differently depending on the language. Or to tell a syntax highlighter what syntax to use.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .html
<p>paragraph <b>emphasis</b>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The class name is placed at the end of the first fence. It can be preceded by a dot, but this is not a requirement. You can also use a special attribute block:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.html #example-1}
<p>paragraph <b>emphasis</b>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In the HTML output, code block attributes will be applied on the code element.