\family default
tags in the HTML output. For example, this input:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
* Bird
\end_layout
\begin_layout Plain Layout
* Magic
\end_layout
\end_inset
\end_layout
\begin_layout Standard
will turn into:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
\end_layout
\end_inset
\end_layout
\begin_layout Standard
It's worth noting that it's possible to trigger an ordered list by
accident, by writing something like this:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
1986. What a great season.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
In other words, a
\emph on
number-period-space
\emph default
sequence at the beginning of a
line. To avoid this, you can backslash-escape the period:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
1986
\backslash
. What a great season.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Pre-formatted code blocks are used for writing about programming or
markup source code. Rather than forming normal paragraphs, the lines
of a code block are interpreted literally. Markdown wraps a code block
in both
\family typewriter
\family default
and
\family typewriter
\family default
tags.
\end_layout
\begin_layout Standard
To produce a code block in Markdown, simply indent every line of the
block by at least 4 spaces or 1 tab. For example, given this input:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
This is a normal paragraph:
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
This is a code block.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Markdown will generate:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
This is a normal paragraph:
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
This is a code block.
\end_layout
\begin_layout Plain Layout
\end_layout
\end_inset
\end_layout
\begin_layout Standard
One level of indentation -- 4 spaces or 1 tab -- is removed from each
line of the code block. For example, this:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
Here is an example of AppleScript:
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
tell application "Foo"
\end_layout
\begin_layout Plain Layout
beep
\end_layout
\begin_layout Plain Layout
end tell
\end_layout
\end_inset
\end_layout
\begin_layout Standard
will turn into:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
Here is an example of AppleScript:
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
tell application "Foo"
\end_layout
\begin_layout Plain Layout
beep
\end_layout
\begin_layout Plain Layout
end tell
\end_layout
\begin_layout Plain Layout
\end_layout
\end_inset
\end_layout
\begin_layout Standard
A code block continues until it reaches a line that is not indented
(or the end of the article).
\end_layout
\begin_layout Standard
Within a code block, ampersands (
\family typewriter
&
\family default
) and angle brackets (
\family typewriter
<
\family default
and
\family typewriter
>
\family default
)
are automatically converted into HTML entities. This makes it very
easy to include example HTML source code using Markdown -- just paste
it and indent it, and Markdown will handle the hassle of encoding the
ampersands and angle brackets. For example, this:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
\end_layout
\end_inset
\end_layout
\begin_layout Standard
will turn into:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
<div class="footer">
\end_layout
\begin_layout Plain Layout
© 2004 Foo Corporation
\end_layout
\begin_layout Plain Layout
</div>
\end_layout
\begin_layout Plain Layout
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Regular Markdown syntax is not processed within code blocks. E.g.,
asterisks are just literal asterisks within a code block. This means
it's also easy to use Markdown to write about Markdown's own syntax.
\end_layout
\begin_layout Standard
You can produce a horizontal rule tag (
\family typewriter
\family default
) by placing three or
more hyphens, asterisks, or underscores on a line by themselves. If you
wish, you may use spaces between the hyphens or asterisks. Each of the
following lines will produce a horizontal rule:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
* * *
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
***
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
*****
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
- - -
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
---------------------------------------
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
_ _ _
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset CommandInset line
LatexCommand rule
offset "0.5ex"
width "100col%"
height "1pt"
\end_inset
\end_layout
\begin_layout Standard
Markdown supports two style of links:
\emph on
inline
\emph default
and
\emph on
reference
\emph default
.
\end_layout
\begin_layout Standard
In both styles, the link text is delimited by [square brackets].
\end_layout
\begin_layout Standard
To create an inline link, use a set of regular parentheses immediately
after the link text's closing square bracket. Inside the parentheses,
put the URL where you want the link to point, along with an
\emph on
optional
\emph default
title for the link, surrounded in quotes. For example:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
This is [an example](http://example.com/ "Title") inline link.
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
[This link](http://example.net/) has no title attribute.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Will produce:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
This is
\end_layout
\begin_layout Plain Layout
an example inline link.
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
This link has no
\end_layout
\begin_layout Plain Layout
title attribute.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
If you're referring to a local resource on the same server, you can
use relative paths:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
See my [About](/about/) page for details.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Reference-style links use a second set of square brackets, inside
which you place a label of your choosing to identify the link:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
This is [an example][id] reference-style link.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
You can optionally use a space to separate the sets of brackets:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
This is [an example] [id] reference-style link.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Then, anywhere in the document, you define your link label like this,
on a line by itself:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
[id]: http://example.com/ "Optional Title Here"
\end_layout
\end_inset
\end_layout
\begin_layout Standard
That is:
\end_layout
\begin_layout Itemize
Square brackets containing the link identifier (optionally
indented from the left margin using up to three spaces);
\end_layout
\begin_layout Itemize
followed by a colon;
\end_layout
\begin_layout Itemize
followed by one or more spaces (or tabs);
\end_layout
\begin_layout Itemize
followed by the URL for the link;
\end_layout
\begin_layout Itemize
optionally followed by a title attribute for the link, enclosed
in double or single quotes.
\end_layout
\begin_layout Standard
The link URL may, optionally, be surrounded by angle brackets:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
[id]: "Optional Title Here"
\end_layout
\end_inset
\end_layout
\begin_layout Standard
You can put the title attribute on the next line and use extra spaces
or tabs for padding, which tends to look better with longer URLs:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
[id]: http://example.com/longish/path/to/resource/here
\end_layout
\begin_layout Plain Layout
"Optional Title Here"
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Link definitions are only used for creating links during Markdown
processing, and are stripped from your document in the HTML output.
\end_layout
\begin_layout Standard
Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are
\emph on
not
\emph default
case sensitive. E.g. these two links:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
[link text][a]
\end_layout
\begin_layout Plain Layout
[link text][A]
\end_layout
\end_inset
\end_layout
\begin_layout Standard
are equivalent.
\end_layout
\begin_layout Standard
The
\emph on
implicit link name
\emph default
shortcut allows you to omit the name of the
link, in which case the link text itself is used as the name.
Just use an empty set of square brackets -- e.g., to link the word
\begin_inset Quotes eld
\end_inset
Google
\begin_inset Quotes erd
\end_inset
to the google.com web site, you could simply write:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
[Google][]
\end_layout
\end_inset
\end_layout
\begin_layout Standard
And then define the link:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
[Google]: http://google.com/
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Because link names may contain spaces, this shortcut even works for
multiple words in the link text:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
Visit [Daring Fireball][] for more information.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
And then define the link:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
[Daring Fireball]: http://daringfireball.net/
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Link definitions can be placed anywhere in your Markdown document. I
tend to put them immediately after each paragraph in which they're
used, but if you want, you can put them all at the end of your
document, sort of like footnotes.
\end_layout
\begin_layout Standard
Here's an example of reference links in action:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
I get 10 times more traffic from [Google] [1] than from
\end_layout
\begin_layout Plain Layout
[Yahoo] [2] or [MSN] [3].
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
[1]: http://google.com/ "Google"
\end_layout
\begin_layout Plain Layout
[2]: http://search.yahoo.com/ "Yahoo Search"
\end_layout
\begin_layout Plain Layout
[3]: http://search.msn.com/ "MSN Search"
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Using the implicit link name shortcut, you could instead write:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
I get 10 times more traffic from [Google][] than from
\end_layout
\begin_layout Plain Layout
[Yahoo][] or [MSN][].
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
[google]: http://google.com/ "Google"
\end_layout
\begin_layout Plain Layout
[yahoo]: http://search.yahoo.com/ "Yahoo Search"
\end_layout
\begin_layout Plain Layout
[msn]: http://search.msn.com/ "MSN Search"
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Both of the above examples will produce the following HTML output:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
I get 10 times more traffic from Google than from
\end_layout
\begin_layout Plain Layout
Yahoo
\end_layout
\begin_layout Plain Layout
or MSN.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
For comparison, here is the same paragraph written using
Markdown's inline link style:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
I get 10 times more traffic from [Google](http://google.com/ "Google")
\end_layout
\begin_layout Plain Layout
than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
\end_layout
\begin_layout Plain Layout
[MSN](http://search.msn.com/ "MSN Search").
\end_layout
\end_inset
\end_layout
\begin_layout Standard
The point of reference-style links is not that they're easier to
write. The point is that with reference-style links, your document
source is vastly more readable. Compare the above examples: using
reference-style links, the paragraph itself is only 81 characters
long; with inline-style links, it's 176 characters; and as raw HTML,
it's 234 characters. In the raw HTML, there's more markup than there
is text.
\end_layout
\begin_layout Standard
With Markdown's reference-style links, a source document much more
closely resembles the final output, as rendered in a browser. By
allowing you to move the markup-related metadata out of the paragraph,
you can add links without interrupting the narrative flow of your
prose.
\end_layout
\begin_layout Standard
Markdown treats asterisks (
\family typewriter
*
\family default
) and underscores (
\family typewriter
_
\family default
) as indicators of
emphasis. Text wrapped with one
\family typewriter
*
\family default
or
\family typewriter
_
\family default
will be wrapped with an
HTML
\family typewriter
\family default
tag; double
\family typewriter
*
\family default
's or
\family typewriter
_
\family default
's will be wrapped with an HTML
\family typewriter
\family default
tag. E.g., this input:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
*single asterisks*
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
_single underscores_
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
**double asterisks**
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
__double underscores__
\end_layout
\end_inset
\end_layout
\begin_layout Standard
will produce:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
single asterisks
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
single underscores
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
double asterisks
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
double underscores
\end_layout
\end_inset
\end_layout
\begin_layout Standard
You can use whichever style you prefer; the lone restriction is that
the same character must be used to open and close an emphasis span.
\end_layout
\begin_layout Standard
Emphasis can be used in the middle of a word:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
un*fucking*believable
\end_layout
\end_inset
\end_layout
\begin_layout Standard
But if you surround an
\family typewriter
*
\family default
or
\family typewriter
_
\family default
with spaces, it'll be treated as a
literal asterisk or underscore.
\end_layout
\begin_layout Standard
To produce a literal asterisk or underscore at a position where it
would otherwise be used as an emphasis delimiter, you can backslash
escape it:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
\backslash
*this text is surrounded by literal asterisks
\backslash
*
\end_layout
\end_inset
\end_layout
\begin_layout Standard
To indicate a span of code, wrap it with backtick quotes (
\family typewriter
`
\family default
).
Unlike a pre-formatted code block, a code span indicates code within a
normal paragraph. For example:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
Use the `printf()` function.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
will produce:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
Use the printf()
function.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
To include a literal backtick character within a code span, you can use
multiple backticks as the opening and closing delimiters:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
``There is a literal backtick (`) here.``
\end_layout
\end_inset
\end_layout
\begin_layout Standard
which will produce this:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
There is a literal backtick (`) here.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
The backtick delimiters surrounding a code span may include spaces --
one after the opening, one before the closing. This allows you to place
literal backtick characters at the beginning or end of a code span:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
A single backtick in a code span: `` ` ``
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
A backtick-delimited string in a code span: `` `foo` ``
\end_layout
\end_inset
\end_layout
\begin_layout Standard
will produce:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
A single backtick in a code span: `
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
A backtick-delimited string in a code span: `foo`
\end_layout
\end_inset
\end_layout
\begin_layout Standard
With a code span, ampersands and angle brackets are encoded as HTML
entities automatically, which makes it easy to include example HTML
tags. Markdown will turn this:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\footnotesize\ttfamily}"
inline false
status collapsed
\begin_layout Plain Layout
Please don't use any `