Click here to Skip to main content
14,326,100 members

Markdown

Forum discussions on CodeProject use Markdown as an option for formatting text. "Markdown" is not a standard: it's a loose, but generally agreed upon, understanding of how ASCII text should be displayed when certain non-alphanumeric characters are added as decorations to words and text blocks.

The Markdown CodeProject uses is very similar to that used in GitHub, Atlassian and StackExchange with some small variations.

Note: Markdown accepts HTML tags. If you include valid HTML tags in your content then they will be rendered as HTML. If you include invalid HTML tags (eg "<tag>") then it will be automatically HTML encoded an not processed as HTML.

Syntax

Headings

Use #, ##, ### etc to generate H1, H2, H3 headings

# Heading level 1
## Heading level 2

Which produces

Heading level 1

Heading level 2

Alternatively you can underline headings with === or --- to get level 1 and level 2 headings:

Heading 1
=========

Heading 2
---------

Paragraphs

Paragraphs are created simply by typing text and separating the text by a blank line. Newlines are preserved.

This is a paragraph
This is a new line

This is a separate paragraph

Code

Inline code is specified using matching `` or ´´ pairs around the code:

This is a ``variable`` name.

Produces

This is a variable name.

Code blocks are specified using matching ``` or ´´´ pairs at the top and bottom of the code block on separate lines:

```
var int i = 0;
```

Produces

var int i = 0;

The language of the code block can be specified by adding it directly after the ```:

```cs
var int i = 0;
```

```javascript
var int i = 0;
```

If you wish to include ``` in your codeblocks (eg to demonstrate Markdown examples) then you can escpe the markup using \:

```text
    Your codeblocks should be of the form

    \```C#
    // some code
    \```
```

will produce

Your codeblocks should be of the form

    ```C#
    // some code
    ```

You can use multiple backticks as the delimiters if you want to include literal backticks in the code span.

Just type ``foo `bar` baz`` at the prompt.

will produce

Just type foo `bar` baz at the prompt.

Inline character formatting

Bold, italics and strikethrough are supported by wrapping text in **, * (or_) and -- respectively

This is **bold**, *italics* and --strikethrough--

Produces

This is bold, italics and strikethrough.

Lists

Use * or - to form unordered lists:

- Apples
- Pears
- Oranges

Produces

  • Apples
  • Pears
  • Oranges

Prefix list items with a number.

1. First
2. Second
3. Third

Produces

  1. First
  2. Second
  3. Third

Nested lists can be generated by indenting subitems two or more spaces.

1. First
2. Second
  - Sub-Second

Produces

  1. First
  2. Second
    • Sub-Second

Blockquotes

Prefix each line in the quote by ">":

> This is a quote
> from someone famous. 
>
> This is a new paragraph inside the quote

Produces

This is a quote from someone famous.

This is a new paragraph inside the quote

Hyperlinks

Either prefix the link by http:// to have it auto-linked, or wrap the link text in [] and the link URL by () to generate a hyperlink:

Visit [CodeProject](www.codeproject.com). Its URL is http://www.codeproject.com.

Produces

If you wish to specify a title (tooltip) for your link, add the title in quotes after the URL:

Visit [CodeProject](www.codeproject.com "CodeProject"). Its URL is http://www.codeproject.com.

Differences to traditional Markdown

Preserving newlines

Markdown was originally created to allow blog content to be converted from plain ASCII to HTML in the simplest, least painful method. Multiple lines were combined into single paragraphs, and paragraph breaks required a blank line. This follows what you'd expect from text written in Notepad.

On CodeProject there is a certain expectation that what you see (in terms of linebreaks) is what you get. Hence we have decided to preserve line breaks.

Inline formatting requires wordbreaks around formatting markers

Like GitHub, we suppress the processing of multiple underscores in words. my_var_name would traditionally be rendered as myvarname which makes discussing code very hard.

Auto-hyperlinking

This is not standard Markup.

Strike-through

This is not standard Markup. Nor is the BLINK tag. This makes us sad.

Fenced code blocks and syntax highlighting

The use of ``` to deliniate code blocks is a GitHub extension we choose to follow for the sake of established Markdown users. We added "´" as an option for those with European keyboards.

Tables

Unlike GitHub we do not support Markdown tables.