En

luo.sh

Markdown Syntax

Published:

Table of Contents

For a quick cheatsheet, check out https://simplemde.com/markdown-guide.


This article offers a sample of basic Markdown syntax that can be used in Blades content files, also it shows whether basic HTML elements are decorated with CSS in a Blades theme.

An h1 header

Paragraphs are separated by a blank line.

2nd paragraph. Italic, bold, Strikethrough, and monospace. Itemized lists look like:

Note that — not considering the asterisk — the actual text content starts at 4-columns in.

Block quotes are written like so.

They can span multiple paragraphs, if you like. Note that you can use Markdown syntax within a blockquote.

Quote break.

Blockquote with attribution Don’t communicate by sharing memory, share memory by communicating.
Rob Pike1

Quote break.

Blockquotes can also be nested…

…by using additional greater-than signs right next to each other…

…or with spaces between arrows.

Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., “it’s all in chapters 12–14”). Three dots … will be converted to an ellipsis. Unicode is supported. ☺

An h2 header

Here’s a numbered list:

  1. first item
  2. second item
  3. third item

Note again how the actual text starts at 4 columns in (4 characters from the left side). Here’s a code sample:

# Let me re-iterate ...
for i in 1 .. 10 { do-something(i) }

As you probably guessed, indented 4 spaces. By the way, instead of indenting the block, you can use delimited blocks, if you like:

#!/bin/bash
for f in $(find . -maxdepth 2 -name '*.tif' -o -name '*.ppm'); do
    nf=${f%.*}.jpg
    wf=${f%.*}.webp

    convert $f -resize 2048x pnm:- | cjpeg -quality 80 -optimize > ${f%/*}/half/${nf##*/}
    echo ${f%/*}/half/${nf##*/} created

    convert $f -resize 1280x pnm:- | cjpeg -quality 80 -optimize > ${f%/*}/retina/${nf##*/}
    echo ${f%/*}/retina/${nf##*/} created

    convert $f -resize 768x pnm:- | cjpeg -quality 80 -optimize > ${f%/*}/thumb/${nf##*/}
    echo ${f%/*}/thumb/${nf##*/} created

    cwebp -resize 2048 0 -q 80 -m 6 -mt -hint photo -quiet $f -o ${f%/*}/half/${wf##*/}
    echo ${f%/*}/half/${wf##*/} created

    cwebp -resize 1280 0 -q 75 -m 6 -mt -hint photo -quiet $f -o ${f%/*}/retina/${wf##*/}
    echo ${f%/*}/retina/${wf##*/} created

    cwebp -resize 768 0 -q 85 -m 6 -mt -hint photo -quiet $f -o ${f%/*}/thumb/${wf##*/}
    echo ${f%/*}/thumb/${wf##*/} created

    ./rm $f
done

(which makes copying & pasting easier). You can optionally mark the delimited block for Pandoc to syntax highlight it:

impl Display for HeadingLevel {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::H1 => write!(f, "h1"),
            Self::H2 => write!(f, "h2"),
            Self::H3 => write!(f, "h3"),
            Self::H4 => write!(f, "h4"),
            Self::H5 => write!(f, "h5"),
            Self::H6 => write!(f, "h6"),
        }
    }
}

An h3 header

Now a nested list:

  1. First, get these ingredients:

    • carrots
    • celery
    • lentils
  2. Boil some water.

  3. Dump everything in the pot and follow this algorithm:

    find wooden spoon
    uncover pot
    stir
    cover pot
    balance wooden spoon precariously on pot handle
    wait 10 minutes
    goto first step (or shut off burner when done)

    Do not bump wooden spoon or it will fall.

Notice again how text always lines up on 4-space indents (including that last line which continues item 3 above).

Here’s a link to a website, to a local doc, and to a section heading in the current doc. Here’s a footnote 2.

Another footnote 3.

Tables can look like this:

Colons can be used to align columns.

TablesAreCool
col 3 isright-aligned$1600
col 2 iscentered$12
zebra stripesare neat$1

There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don’t need to make the raw Markdown line up prettily. You can also use inline Markdown.

MarkdownLessPretty
Stillrendersnicely
123
First HeaderSecond Header
Content CellContent Cell
Content CellContent Cell
CommandDescription
git statusList all new or modified files
git diffShow file differences that haven’t been staged
CommandDescription
git statusList all new or modified files
git diffShow file differences that haven’t been staged
Left-alignedCenter-alignedRight-aligned
git statusgit statusgit status
git diffgit diffgit diff
NameCharacter
Backtick`
Pipe|

A horizontal rule follows.


and images can be specified like so:

example image

Inline math equations go in like so: 𝜔=d𝜑d𝑡. Display math should get its own line and be put in in double-dollarsigns:

𝐼=𝜌𝑅2d𝑉𝑒𝑥=lim𝑛(1+𝑥𝑛)𝑛𝑓(𝑎)=12𝜋𝑖𝛾𝑓(𝑧)𝑧𝑎d𝑧

Web Math Demo.

And note that you can backslash-escape any punctuation characters which you wish to be displayed literally, ex.: `foo`, *bar*, etc.

D2 Diagrams

bankCorporateEquitiesSecuritiesFinanceRiskFundsFixed IncomeData Sourcetco: 100,000owner: LakshmiRisk Globaltco: 600,000owner: WendyCredit guardtco: 100,000owner: LakshmiSeven heaventco: 100,000owner: TomosApac Acetco: 400,000owner: WendyRisk Globaltco: 900,000owner: TomosZone outtco: 500,000owner: WendyCredit guardtco: 700,000owner: IndiaArk Cryptotco: 1,500,000owner: WendyData Solartco: 1,200,000owner: DeepakSeven heaventco: 0owner: JoesphCrypto Bottco: 1,100,000owner: WendyRisk Globaltco: 500,000owner: JoesphARC3tco: 600,000owner: WendyAcmazetco: 100,000owner: Tomosclient mastergreeksallocationstradesordersgreeksordersordersgreeksallocationstradessecurity reference

Task lists

Other Elements — abbr, sub, sup, kbd, mark

GIF is a bitmap image format.

H2O

Xn + Yn = Zn

Press CTRL+ALT+Delete to end the session.

Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures.

  1. The above quote is excerpted from Rob Pike’s talk during Gopherfest, November 18, 2015.

  2. Footnote text goes here.

  3. Another footnote text goes here.

#markdown