2014-05-08 02:02:46 +08:00
<!doctype html>
< html >
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1, minimal-ui" >
< title > GitHub Markdown CSS demo< / title >
2021-10-17 20:15:46 +08:00
< meta name = "color-scheme" content = "light dark" >
2014-05-08 02:02:46 +08:00
< link rel = "stylesheet" href = "github-markdown.css" >
< style >
body {
2015-12-07 02:56:04 +08:00
box-sizing: border-box;
2014-05-08 03:17:18 +08:00
min-width: 200px;
2015-12-07 02:56:04 +08:00
max-width: 980px;
2014-05-08 03:17:18 +08:00
margin: 0 auto;
2015-12-07 02:56:04 +08:00
padding: 45px;
2014-05-08 02:02:46 +08:00
}
2021-10-17 20:15:46 +08:00
@media (prefers-color-scheme: dark) {
body {
background-color: #0d1117;
}
}
2014-05-08 02:02:46 +08:00
< / style >
2021-08-08 17:55:05 +08:00
< link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css" >
< style >
.github-fork-ribbon:before {
background-color: #121612;
}
< / style >
2014-05-08 02:02:46 +08:00
< / head >
< body >
< article class = "markdown-body" >
2016-01-09 23:38:08 +08:00
< h1 > < a id = "user-content-github-markdown-css-demo" class = "anchor" href = "#github-markdown-css-demo" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > GitHub Markdown CSS demo< / h1 >
< p > < a name = "user-content-headers" > < / a > < / p > < a name = "user-content-headers" >
< / a > < h2 > < a name = "user-content-headers" > < / a > < a id = "user-content-headers" class = "anchor" href = "#headers" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Headers< / h2 >
< pre lang = "no-highlight" > < code > # H1
## H2
### H3
#### H4
##### H5
###### H6
Alternatively, for H1 and H2, an underline-ish style:
Alt-H1
======
Alt-H2
------
< / code > < / pre >
< h1 > < a id = "user-content-h1" class = "anchor" href = "#h1" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > H1< / h1 >
< h2 > < a id = "user-content-h2" class = "anchor" href = "#h2" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > H2< / h2 >
< h3 > < a id = "user-content-h3" class = "anchor" href = "#h3" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > H3< / h3 >
< h4 > < a id = "user-content-h4" class = "anchor" href = "#h4" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > H4< / h4 >
< h5 > < a id = "user-content-h5" class = "anchor" href = "#h5" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > H5< / h5 >
< h6 > < a id = "user-content-h6" class = "anchor" href = "#h6" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > H6< / h6 >
< p > Alternatively, for H1 and H2, an underline-ish style:< / p >
< h1 > < a id = "user-content-alt-h1" class = "anchor" href = "#alt-h1" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Alt-H1< / h1 >
< h2 > < a id = "user-content-alt-h2" class = "anchor" href = "#alt-h2" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Alt-H2< / h2 >
< p > < a name = "user-content-headers" > < / a > < a name = "user-content-emphasis" > < / a > < / p > < a name = "user-content-emphasis" >
< / a > < h2 > < a name = "user-content-emphasis" > < / a > < a id = "user-content-emphasis" class = "anchor" href = "#emphasis" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Emphasis< / h2 >
< pre lang = "no-highlight" > < code > Emphasis, aka italics, with *asterisks* or _underscores_.
Strong emphasis, aka bold, with **asterisks** or __underscores__.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses two tildes. ~~Scratch this.~~
< / code > < / pre >
< p > Emphasis, aka italics, with < em > asterisks< / em > or < em > underscores< / em > .< / p >
< p > Strong emphasis, aka bold, with < strong > asterisks< / strong > or < strong > underscores< / strong > .< / p >
< p > Combined emphasis with < strong > asterisks and < em > underscores< / em > < / strong > .< / p >
< p > Strikethrough uses two tildes. < del > Scratch this.< / del > < / p >
< p > < a name = "user-content-emphasis" > < / a > < a name = "user-content-lists" > < / a > < / p > < a name = "user-content-lists" >
< / a > < h2 > < a name = "user-content-lists" > < / a > < a id = "user-content-lists" class = "anchor" href = "#lists" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Lists< / h2 >
< p > (In this example, leading and trailing spaces are shown with with dots: ⋅)< / p >
< pre lang = "no-highlight" > < code > 1. First ordered list item
2. Another item
⋅⋅* Unordered sub-list.
1. Actual numbers don't matter, just that it's a number
⋅⋅1. Ordered sub-list
4. And another item.
⋅⋅⋅You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅
⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅
⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
* Unordered list can use asterisks
- Or minuses
+ Or pluses
< / code > < / pre >
< ol >
< li > First ordered list item< / li >
< li > Another item
< ul >
< li > Unordered sub-list.< / li >
< / ul > < / li >
< li > Actual numbers don't matter, just that it's a number
< ol >
< li > Ordered sub-list< / li >
< / ol > < / li >
< li > < p > And another item.< / p >
< p > You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).< / p >
< p > To have a line break without a paragraph, you will need to use two trailing spaces.
Note that this line is separate, but within the same paragraph.
(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)< / p > < / li >
< / ol >
< ul >
< li > Unordered list can use asterisks< / li >
< li > Or minuses< / li >
< li > < p > Or pluses< / p > < / li >
< / ul >
< ol >
< li > foo
< ol >
< li > bar
< ol >
< li > baz
< ol >
< li > faz< / li >
< / ol > < / li >
< / ol > < / li >
< / ol > < / li >
< li > < p > foo2< / p > < / li >
< / ol >
< ul >
< li > foo
< ul >
< li > bar
< ul >
< li > baz
< ul >
< li > faz< / li >
< / ul > < / li >
< / ul > < / li >
< / ul > < / li >
< li > < p > foo2< / p > < / li >
< / ul >
< ol >
< li > < p > foo< / p >
< ul >
< li > bar
< ol >
< li > baz
< ul >
< li > faz< / li >
< / ul > < / li >
< / ol > < / li >
< / ul > < / li >
< / ol >
< ul >
< li > < p > foo< / p >
< ol >
< li > bar
< ul >
< li > baz
< ol >
< li > faz< / li >
< / ol > < / li >
< / ul > < / li >
< / ol > < / li >
< / ul >
< ol >
< li > Lists in a list item:
< ul >
< li > Indented four spaces.
< ul >
< li > indented eight spaces.< / li >
< / ul > < / li >
< li > Four spaces again.< / li >
< / ul > < / li >
< li > < p > Multiple paragraphs in a list items:
It's best to indent the paragraphs four spaces
You can get away with three, but it can get
confusing when you nest other things.
Stick to four.< / p >
< p > We indented the first line an extra space to align
it with these paragraphs. In real use, we might do
that to the entire list so that all items line up.< / p >
< p > This paragraph is still part of the list item, but it looks messy to humans. So it's a good idea to wrap your nested paragraphs manually, as we did with the first two.< / p > < / li >
< li > < p > Blockquotes in a list item:< / p >
< blockquote >
< p > Skip a line and
indent the > 's four spaces.< / p >
< / blockquote > < / li >
< li > < p > Preformatted text in a list item:< / p >
< pre > < code > Skip a line and indent eight spaces.
That's four spaces for the list
and four to trigger the code block.
< / code > < / pre > < / li >
< / ol >
< h2 > < a id = "user-content-inline-html" class = "anchor" href = "#inline-html" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Inline HTML< / h2 >
< p > To reboot your computer, press < kbd > ctrl< / kbd > +< kbd > alt< / kbd > +< kbd > del< / kbd > .< / p >
< p > < a name = "user-content-lists" > < / a > < a name = "user-content-links" > < / a > < / p > < a name = "user-content-links" >
< / a > < h2 > < a name = "user-content-links" > < / a > < a id = "user-content-links" class = "anchor" href = "#links" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Links< / h2 >
< p > There are two ways to create links.< / p >
< pre lang = "no-highlight" > < code > [I'm an inline-style link](https://www.google.com)
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
[I'm a reference-style link][Arbitrary case-insensitive reference text]
[I'm a relative reference to a repository file](../blob/master/LICENSE)
[You can use numbers for reference-style link definitions][1]
Or leave it empty and use the [link text itself]
Some text to show that the reference links can follow later.
[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com
< / code > < / pre >
< p > < a name = "user-content-links" > < / a > < a href = "https://www.google.com" > I'm an inline-style link< / a > < / p >
< p > < a href = "https://www.google.com" title = "Google's Homepage" > I'm an inline-style link with title< / a > < / p >
< p > < a href = "https://www.mozilla.org" > I'm a reference-style link< / a > < / p >
< p > < a href = "/tylerlong/github-markdown-css-demo/blob/blob/master/LICENSE" > I'm a relative reference to a repository file< / a > < / p >
< p > < a href = "http://slashdot.org" > You can use numbers for reference-style link definitions< / a > < / p >
< p > Or leave it empty and use the < a href = "http://www.reddit.com" > link text itself< / a > < / p >
< p > Some text to show that the reference links can follow later.< / p >
< p > < a name = "user-content-images" > < / a > < / p > < a name = "user-content-images" >
< / a > < h2 > < a name = "user-content-images" > < / a > < a id = "user-content-images" class = "anchor" href = "#images" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Images< / h2 >
< pre lang = "no-highlight" > < code > Here's our logo (hover to see the title text):
Inline-style:
![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
Reference-style:
![alt text][logo]
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
< / code > < / pre >
< p > Here's our logo (hover to see the title text):< / p >
< p > Inline-style:
< img src = "https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png" alt = "alt text" title = "Logo Title Text 1" style = "max-width:100%;" > < / p >
< p > Reference-style:
< img src = "https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png" alt = "alt text" title = "Logo Title Text 2" style = "max-width:100%;" > < / p >
< p > < a name = "user-content-images" > < / a > < a name = "user-content-code" > < / a > < / p > < a name = "user-content-code" >
< / a > < h2 > < a name = "user-content-code" > < / a > < a id = "user-content-code-and-syntax-highlighting" class = "anchor" href = "#code-and-syntax-highlighting" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Code and Syntax Highlighting< / h2 >
< p > < a name = "user-content-code" > Code blocks are part of the Markdown spec, but syntax highlighting isn't. However, many renderers -- like Github's and < em > Markdown Here< / em > -- support syntax highlighting. Which languages are supported and how those language names should be written will vary from renderer to renderer. < em > Markdown Here< / em > supports highlighting for dozens of languages (and not-really-languages, like diffs and HTTP headers); to see the complete list, and how to write the language names, see the < / a > < a href = "http://softwaremaniacs.org/media/soft/highlight/test.html" > highlight.js demo page< / a > .< / p >
< pre lang = "no-highlight" > < code > Inline `code` has `back-ticks around` it.
< / code > < / pre >
< p > Inline < code > code< / code > has < code > back-ticks around< / code > it.< / p >
< p > Blocks of code are either fenced by lines with three back-ticks < code > ```< / code > , or are indented with four spaces. I recommend only using the fenced code blocks -- they're easier and only they support syntax highlighting.< / p >
< pre lang = "no-highlight" > < code > ```javascript
var s = "JavaScript syntax highlighting";
alert(s);
```
```python
s = "Python syntax highlighting"
print s
```
```
No language indicated, so no syntax highlighting.
But let's throw in a < b> tag< /b> .
```
< / code > < / pre >
< div class = "highlight highlight-source-js" > < pre > < span class = "pl-k" > var< / span > s < span class = "pl-k" > =< / span > < span class = "pl-s" > < span class = "pl-pds" > "< / span > JavaScript syntax highlighting< span class = "pl-pds" > "< / span > < / span > ;
< span class = "pl-c1" > alert< / span > (s);< / pre > < / div >
< div class = "highlight highlight-source-python" > < pre > s < span class = "pl-k" > =< / span > < span class = "pl-s" > < span class = "pl-pds" > "< / span > Python syntax highlighting< span class = "pl-pds" > "< / span > < / span >
< span class = "pl-k" > print< / span > s< / pre > < / div >
< pre > < code > No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
But let's throw in a < b> tag< /b> .
< / code > < / pre >
< p > < a name = "user-content-tables" > < / a > < / p > < a name = "user-content-tables" >
< / a > < h2 > < a name = "user-content-tables" > < / a > < a id = "user-content-tables" class = "anchor" href = "#tables" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Tables< / h2 >
< p > Tables aren't part of the core Markdown spec, but they are part of GFM and < em > Markdown Here< / em > supports them. They are an easy way of adding tables to your email -- a task that would otherwise require copy-pasting from another application.< / p >
< pre lang = "no-highlight" > < code > Colons can be used to align columns.
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | |
| col 2 is | centered | |
| zebra stripes | are neat | |
The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
Markdown | Less | Pretty
--- | --- | ---
*Still* | `renders` | **nicely**
1 | 2 | 3
< / code > < / pre >
< p > Colons can be used to align columns.< / p >
< table > < thead >
< tr >
< th > Tables< / th >
< th align = "center" > Are< / th >
< th align = "right" > Cool< / th >
< / tr >
< / thead > < tbody >
< tr >
< td > col 3 is< / td >
< td align = "center" > right-aligned< / td >
< td align = "right" > < / td >
< / tr >
< tr >
< td > col 2 is< / td >
< td align = "center" > centered< / td >
< td align = "right" > < / td >
< / tr >
< tr >
< td > zebra stripes< / td >
< td align = "center" > are neat< / td >
< td align = "right" > < / td >
< / tr >
< / tbody > < / table >
< p > The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.< / p >
< table > < thead >
< tr >
< th > Markdown< / th >
< th > Less< / th >
< th > Pretty< / th >
< / tr >
< / thead > < tbody >
< tr >
< td > < em > Still< / em > < / td >
< td > < code > renders< / code > < / td >
< td > < strong > nicely< / strong > < / td >
< / tr >
< tr >
< td > 1< / td >
< td > 2< / td >
< td > 3< / td >
< / tr >
< / tbody > < / table >
< p > < a name = "user-content-tables" > < / a > < a name = "user-content-blockquotes" > < / a > < / p > < a name = "user-content-blockquotes" >
< / a > < h2 > < a name = "user-content-blockquotes" > < / a > < a id = "user-content-blockquotes" class = "anchor" href = "#blockquotes" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Blockquotes< / h2 >
< pre lang = "no-highlight" > < code > > Blockquotes are very handy in email to emulate reply text.
> This line is part of the same quote.
Quote break.
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
< / code > < / pre >
< blockquote >
< p > Blockquotes are very handy in email to emulate reply text.
This line is part of the same quote.< / p >
< / blockquote >
< p > Quote break.< / p >
< blockquote >
< p > This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can < em > put< / em > < strong > Markdown< / strong > into a blockquote.< / p >
< / blockquote >
< p > < a name = "user-content-blockquotes" > < / a > < a name = "user-content-html" > < / a > < / p > < a name = "user-content-html" >
< / a > < h2 > < a name = "user-content-html" > < / a > < a id = "user-content-inline-html-1" class = "anchor" href = "#inline-html-1" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Inline HTML< / h2 >
< p > You can also use raw HTML in your Markdown, and it'll mostly work pretty well.< / p >
< pre lang = "no-highlight" > < code > < dl>
< dt> Definition list< /dt>
< dd> Is something people use sometimes.< /dd>
< dt> Markdown in HTML< /dt>
< dd> Does *not* work **very** well. Use HTML < em> tags< /em> .< /dd>
< /dl>
< / code > < / pre >
< dl >
< dt > Definition list< / dt >
< dd > Is something people use sometimes.< / dd >
< dt > Markdown in HTML< / dt >
< dd > Does *not* work **very** well. Use HTML < em > tags< / em > .< / dd >
< / dl >
< p > < a name = "user-content-html" > < / a > < a name = "user-content-hr" > < / a > < / p > < a name = "user-content-hr" >
< / a > < h2 > < a name = "user-content-hr" > < / a > < a id = "user-content-horizontal-rule" class = "anchor" href = "#horizontal-rule" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Horizontal Rule< / h2 >
< pre > < code > Three or more...
---
Hyphens
***
Asterisks
___
Underscores
< / code > < / pre >
< p > Three or more...< / p >
< hr >
< p > Hyphens< / p >
< hr >
< p > Asterisks< / p >
< hr >
< p > Underscores< / p >
< p > < a name = "user-content-hr" > < / a > < a name = "user-content-lines" > < / a > < / p > < a name = "user-content-lines" >
< / a > < h2 > < a name = "user-content-lines" > < / a > < a id = "user-content-line-breaks" class = "anchor" href = "#line-breaks" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Line Breaks< / h2 >
< p > My basic recommendation for learning how line breaks work is to experiment and discover -- hit < Enter> once (i.e., insert one newline), then hit it twice (i.e., insert two newlines), see what happens. You'll soon learn to get what you want. "Markdown Toggle" is your friend.< / p >
< p > Here are some things to try out:< / p >
< pre > < code > Here's a line for us to start with.
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
This line is also a separate paragraph, but...
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
< / code > < / pre >
< p > Here's a line for us to start with.< / p >
< p > This line is separated from the one above by two newlines, so it will be a < em > separate paragraph< / em > .< / p >
< p > This line is also begins a separate paragraph, but...
This line is only separated by a single newline, so it's a separate line in the < em > same paragraph< / em > .< / p >
< p > (Technical note: < em > Markdown Here< / em > uses GFM line breaks, so there's no need to use MD's two-space line breaks.)< / p >
< p > < a name = "user-content-lines" > < / a > < a name = "user-content-videos" > < / a > < / p > < a name = "user-content-videos" >
< / a > < h2 > < a name = "user-content-videos" > < / a > < a id = "user-content-youtube-videos" class = "anchor" href = "#youtube-videos" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Youtube videos< / h2 >
< p > They can't be added directly but you can add an image with a link to the video like this:< / p >
< pre lang = "no-highlight" > < code > < a href="http://www.youtube.com/watch?feature=player_embedded& v=YOUTUBE_VIDEO_ID_HERE
" target="_blank"> < img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /> < /a>
< / code > < / pre >
< p > Or, in pure Markdown, but losing the image sizing and border:< / p >
< pre lang = "no-highlight" > < code > [![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)
< / code > < / pre >
< p > Referencing a bug by #bugID in your git commit links it to the slip. For example #1.< / p >
< h2 > < a id = "user-content-task-list" class = "anchor" href = "#task-list" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Task List< / h2 >
< ul class = "task-list" >
< li class = "task-list-item" > < input type = "checkbox" class = "task-list-item-checkbox" disabled = "disabled" > foo
< ul class = "task-list" >
< li class = "task-list-item" > < input type = "checkbox" class = "task-list-item-checkbox" disabled = "disabled" > foo< / li >
< li class = "task-list-item" > < input type = "checkbox" class = "task-list-item-checkbox" checked = "checked" disabled = "disabled" > foo< / li >
< / ul > < / li >
< li class = "task-list-item" > < input type = "checkbox" class = "task-list-item-checkbox" checked = "checked" disabled = "disabled" > foo< / li >
< / ul >
< p > < a name = "user-content-videos" > [test]: < / a > < a href = "http://google.com/" > http://google.com/< / a > "Google"< / p >
< h1 > < a id = "user-content-a-heading" class = "anchor" href = "#a-heading" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > A heading< / h1 >
< p > Just a note, I've found that I can't test my markdown parser vs others.
For example, both markdown.js and showdown code blocks in lists wrong. They're
also completely [inconsistent][test] with regards to paragraphs in list items.< / p >
< p > A link. Not anymore.< / p >
< p > < / p > This will make me fail the test because
markdown.js doesnt acknowledge arbitrary html blocks =/< p > < / p >
< ul >
< li > < p > List Item 1< / p > < / li >
< li > < p > List Item 2< / p >
< ul >
< li > New List Item 1
Hi, this is a list item.< / li >
< li > New List Item 2
Another item
Code goes here.
Lots of it...< / li >
< li > New List Item 3
The last item< / li >
< / ul > < / li >
< li > < p > List Item 3
The final item.< / p > < / li >
< li > < p > List Item 4
The real final item.< / p > < / li >
< / ul >
< p > Paragraph.< / p >
< blockquote >
< ul >
< li > bq Item 1< / li >
< li > bq Item 2
< ul >
< li > New bq Item 1< / li >
< li > New bq Item 2
Text here< / li >
< / ul > < / li >
< / ul >
< / blockquote >
< hr >
< blockquote >
< p > Another blockquote!
I really need to get
more creative with
mockup text..
markdown.js breaks here again< / p >
< / blockquote >
< h2 > < a id = "user-content-another-heading" class = "anchor" href = "#another-heading" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Another Heading< / h2 >
< p > Hello < em > world< / em > . Here is a < a href = "//hello" > link< / a > .
And an image < a href = "/tylerlong/github-markdown-css-demo/blob/master/src" target = "_blank" > < img src = "/tylerlong/github-markdown-css-demo/raw/master/src" alt = "alt" style = "max-width:100%;" > < / a > .< / p >
< pre > < code > Code goes here.
Lots of it...
< / code > < / pre >
< blockquote >
< p > A list within a blockquote:< / p >
< ul >
< li > asterisk 1< / li >
< li > asterisk 2< / li >
< li > asterisk 3< / li >
< / ul >
< / blockquote >
< p > < strong > < em > This is strong and em.< / em > < / strong > < / p >
< p > So is < strong > < em > this< / em > < / strong > word.< / p >
< p > < strong > < em > This is strong and em.< / em > < / strong > < / p >
< p > So is < strong > < em > this< / em > < / strong > word.< / p >
< h2 > < a id = "user-content-unordered" class = "anchor" href = "#unordered" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Unordered< / h2 >
< p > Asterisks tight:< / p >
< ul >
< li > asterisk 1< / li >
< li > asterisk 2< / li >
< li > asterisk 3< / li >
< / ul >
< p > Asterisks loose:< / p >
< ul >
< li > < p > asterisk 1< / p > < / li >
< li > < p > asterisk 2< / p > < / li >
< li > < p > asterisk 3< / p > < / li >
< / ul >
< hr >
< p > Pluses tight:< / p >
< ul >
< li > Plus 1< / li >
< li > Plus 2< / li >
< li > Plus 3< / li >
< / ul >
< p > Pluses loose:< / p >
< ul >
< li > < p > Plus 1< / p > < / li >
< li > < p > Plus 2< / p > < / li >
< li > < p > Plus 3< / p > < / li >
< / ul >
< hr >
< p > Minuses tight:< / p >
< ul >
< li > Minus 1< / li >
< li > Minus 2< / li >
< li > Minus 3< / li >
< / ul >
< p > Minuses loose:< / p >
< ul >
< li > < p > Minus 1< / p > < / li >
< li > < p > Minus 2< / p > < / li >
< li > < p > Minus 3< / p > < / li >
< / ul >
< h2 > < a id = "user-content-ordered" class = "anchor" href = "#ordered" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Ordered< / h2 >
< p > Tight:< / p >
< ol >
< li > First< / li >
< li > Second< / li >
< li > Third< / li >
< / ol >
< p > and:< / p >
< ol >
< li > One< / li >
< li > Two< / li >
< li > Three< / li >
< / ol >
< p > Loose using tabs:< / p >
< ol >
< li > < p > First< / p > < / li >
< li > < p > Second< / p > < / li >
< li > < p > Third< / p > < / li >
< / ol >
< p > and using spaces:< / p >
< ol >
< li > < p > One< / p > < / li >
< li > < p > Two< / p > < / li >
< li > < p > Three< / p > < / li >
< / ol >
< p > Multiple paragraphs:< / p >
< ol >
< li > < p > Item 1, graf one.< / p >
< p > Item 2. graf two. The quick brown fox jumped over the lazy dog's
back.< / p > < / li >
< li > < p > Item 2.< / p > < / li >
< li > < p > Item 3.< / p > < / li >
< / ol >
< h2 > < a id = "user-content-nested" class = "anchor" href = "#nested" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Nested< / h2 >
< ul >
< li > Tab
< ul >
< li > Tab
< ul >
< li > Tab< / li >
< / ul > < / li >
< / ul > < / li >
< / ul >
< p > Here's another:< / p >
< ol >
< li > First< / li >
< li > Second:
< ul >
< li > Fee< / li >
< li > Fie< / li >
< li > Foe< / li >
< / ul > < / li >
< li > Third< / li >
< / ol >
< p > Same thing but with paragraphs:< / p >
< ol >
< li > < p > First< / p > < / li >
< li > < p > Second:< / p >
< ul >
< li > Fee< / li >
< li > Fie< / li >
< li > Foe< / li >
< / ul > < / li >
< li > < p > Third< / p > < / li >
< / ol >
< p > This was an error in Markdown 1.0.1:< / p >
< ul >
< li > < p > this< / p >
< ul >
< li > sub< / li >
< / ul >
< p > that< / p > < / li >
< / ul >
< blockquote >
< p > foo< / p >
< blockquote >
< p > bar< / p >
< / blockquote >
< p > foo< / p >
< / blockquote >
< h1 > < a id = "user-content-markdown-syntax" class = "anchor" href = "#markdown-syntax" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Markdown: Syntax< / h1 >
< ul id = "user-content-ProjectSubmenu" >
< li > < a href = "/tylerlong/github-markdown-css-demo/blob/master/projects/markdown" title = "Markdown Project Page" > Main< / a > < / li >
< li > < a href = "/tylerlong/github-markdown-css-demo/blob/master/projects/markdown/basics" title = "Markdown Basics" > Basics< / a > < / li >
< li > Syntax< / li >
< li > < a href = "/tylerlong/github-markdown-css-demo/blob/master/projects/markdown/license" title = "Pricing and License Information" > License< / a > < / li >
< li > < a href = "/tylerlong/github-markdown-css-demo/blob/master/projects/markdown/dingus" title = "Online Markdown Web Form" > Dingus< / a > < / li >
< / ul >
< ul >
< li > < a href = "#overview" > Overview< / a >
< ul >
< li > < a href = "#philosophy" > Philosophy< / a > < / li >
< li > < a href = "#html" > Inline HTML< / a > < / li >
< li > < a href = "#autoescape" > Automatic Escaping for Special Characters< / a > < / li >
< / ul > < / li >
< li > < a href = "#block" > Block Elements< / a >
< ul >
< li > < a href = "#p" > Paragraphs and Line Breaks< / a > < / li >
< li > < a href = "#header" > Headers< / a > < / li >
< li > < a href = "#blockquote" > Blockquotes< / a > < / li >
< li > < a href = "#list" > Lists< / a > < / li >
< li > < a href = "#precode" > Code Blocks< / a > < / li >
< li > < a href = "#hr" > Horizontal Rules< / a > < / li >
< / ul > < / li >
< li > < a href = "#span" > Span Elements< / a >
< ul >
< li > < a href = "#link" > Links< / a > < / li >
< li > < a href = "#em" > Emphasis< / a > < / li >
< li > < a href = "#code" > Code< / a > < / li >
< li > < a href = "#img" > Images< / a > < / li >
< / ul > < / li >
< li > < a href = "#misc" > Miscellaneous< / a >
< ul >
< li > < a href = "#backslash" > Backslash Escapes< / a > < / li >
< li > < a href = "#autolink" > Automatic Links< / a > < / li >
< / ul > < / li >
< / ul >
< p > < strong > Note:< / strong > This document is itself written using Markdown; you
can [see the source for it by adding '.text' to the URL][src].< / p >
< p > [src]: /projects/markdown/syntax.text< / p >
< hr >
< h2 id = "user-content-overview" > < a id = "user-content-overview" class = "anchor" href = "#overview" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Overview< / h2 >
< h3 id = "user-content-philosophy" > < a id = "user-content-philosophy" class = "anchor" href = "#philosophy" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Philosophy< / h3 >
< p > Markdown is intended to be as easy-to-read and easy-to-write as is feasible.< / p >
< p > Readability, however, is emphasized above all else. A Markdown-formatted
document should be publishable as-is, as plain text, without looking
like it's been marked up with tags or formatting instructions. While
Markdown's syntax has been influenced by several existing text-to-HTML
filters -- including < a href = "http://slashdot.org" > Setext< / a > , [atx] [2], [Textile] [3], [reStructuredText] [4],
[Grutatext] [5], and [EtText] [6] -- the single biggest source of
inspiration for Markdown's syntax is the format of plain text email.< / p >
< p > < a href = "http://slashdot.org" > 1< / a > : < a href = "http://docutils.sourceforge.net/mirror/setext.html" > http://docutils.sourceforge.net/mirror/setext.html< / a >
[2]: < a href = "http://www.aaronsw.com/2002/atx/" > http://www.aaronsw.com/2002/atx/< / a >
[3]: < a href = "http://textism.com/tools/textile/" > http://textism.com/tools/textile/< / a >
[4]: < a href = "http://docutils.sourceforge.net/rst.html" > http://docutils.sourceforge.net/rst.html< / a >
[5]: < a href = "http://www.triptico.com/software/grutatxt.html" > http://www.triptico.com/software/grutatxt.html< / a >
[6]: < a href = "http://ettext.taint.org/doc/" > http://ettext.taint.org/doc/< / a > < / p >
< p > To this end, Markdown's syntax is comprised entirely of punctuation
characters, which punctuation characters have been carefully chosen so
as to look like what they mean. E.g., asterisks around a word actually
look like *emphasis*. Markdown lists look like, well, lists. Even
blockquotes look like quoted passages of text, assuming you've ever
used email.< / p >
< h3 id = "user-content-html" > < a id = "user-content-inline-html-2" class = "anchor" href = "#inline-html-2" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Inline HTML< / h3 >
< p > Markdown's syntax is intended for one purpose: to be used as a
format for < em > writing< / em > for the web.< / p >
< p > Markdown is not a replacement for HTML, or even close to it. Its
syntax is very small, corresponding only to a very small subset of
HTML tags. The idea is < em > not< / em > to create a syntax that makes it easier
to insert HTML tags. In my opinion, HTML tags are already easy to
insert. The idea for Markdown is to make it easy to read, write, and
edit prose. HTML is a < em > publishing< / em > format; Markdown is a < em > writing< / em >
format. Thus, Markdown's formatting syntax only addresses issues that
can be conveyed in plain text.< / p >
< p > For any markup that is not covered by Markdown's syntax, you simply
use HTML itself. There's no need to preface it or delimit it to
indicate that you're switching from Markdown to HTML; you just use
the tags.< / p >
< p > The only restrictions are that block-level HTML elements -- e.g. < code > < div> < / code > ,
< code > < table> < / code > , < code > < pre> < / code > , < code > < p> < / code > , etc. -- must be separated from surrounding
content by blank lines, and the start and end tags of the block should
not be indented with tabs or spaces. Markdown is smart enough not
to add extra (unwanted) < code > < p> < / code > tags around HTML block-level tags.< / p >
< p > For example, to add an HTML table to a Markdown article:< / p >
< pre > < code > This is a regular paragraph.
< table>
< tr>
< td> Foo< /td>
< /tr>
< /table>
This is another regular paragraph.
< / code > < / pre >
< p > Note that Markdown formatting syntax is not processed within block-level
HTML tags. E.g., you can't use Markdown-style < code > *emphasis*< / code > inside an
HTML block.< / p >
< p > Span-level HTML tags -- e.g. < code > < span> < / code > , < code > < cite> < / code > , or < code > < del> < / code > -- can be
used anywhere in a Markdown paragraph, list item, or header. If you
want, you can even use HTML tags instead of Markdown formatting; e.g. if
you'd prefer to use HTML < code > < a> < / code > or < code > < img> < / code > tags instead of Markdown's
link or image syntax, go right ahead.< / p >
< p > Unlike block-level HTML tags, Markdown syntax < em > is< / em > processed within
span-level tags.< / p >
< h3 id = "user-content-autoescape" > < a id = "user-content-automatic-escaping-for-special-characters" class = "anchor" href = "#automatic-escaping-for-special-characters" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Automatic Escaping for Special Characters< / h3 >
< p > In HTML, there are two characters that demand special treatment: < code > < < / code >
and < code > & < / code > . Left angle brackets are used to start tags; ampersands are
used to denote HTML entities. If you want to use them as literal
characters, you must escape them as entities, e.g. < code > & lt;< / code > , and
< code > & amp;< / code > .< / p >
< p > Ampersands in particular are bedeviling for web writers. If you want to
write about 'AT& T', you need to write '< code > AT& amp;T< / code > '. You even need to
escape ampersands within URLs. Thus, if you want to link to:< / p >
< pre > < code > http://images.google.com/images?num=30& q=larry+bird
< / code > < / pre >
< p > you need to encode the URL as:< / p >
< pre > < code > http://images.google.com/images?num=30& amp;q=larry+bird
< / code > < / pre >
< p > in your anchor tag < code > href< / code > attribute. Needless to say, this is easy to
forget, and is probably the single most common source of HTML validation
errors in otherwise well-marked-up web sites.< / p >
< p > Markdown allows you to use these characters naturally, taking care of
all the necessary escaping for you. If you use an ampersand as part of
an HTML entity, it remains unchanged; otherwise it will be translated
into < code > & amp;< / code > .< / p >
< p > So, if you want to include a copyright symbol in your article, you can write:< / p >
< pre > < code > & copy;
< / code > < / pre >
< p > and Markdown will leave it alone. But if you write:< / p >
< pre > < code > AT& T
< / code > < / pre >
< p > Markdown will translate it to:< / p >
< pre > < code > AT& amp;T
< / code > < / pre >
< p > Similarly, because Markdown supports < a href = "#html" > inline HTML< / a > , if you use
angle brackets as delimiters for HTML tags, Markdown will treat them as
such. But if you write:< / p >
< pre > < code > 4 < 5
< / code > < / pre >
< p > Markdown will translate it to:< / p >
< pre > < code > 4 & lt; 5
< / code > < / pre >
< p > However, inside Markdown code spans and blocks, angle brackets and
ampersands are < em > always< / em > encoded automatically. This makes it easy to use
Markdown to write about HTML code. (As opposed to raw HTML, which is a
terrible format for writing about HTML syntax, because every single < code > < < / code >
and < code > & < / code > in your example code needs to be escaped.)< / p >
< hr >
< h2 id = "user-content-block" > < a id = "user-content-block-elements" class = "anchor" href = "#block-elements" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Block Elements< / h2 >
< h3 id = "user-content-p" > < a id = "user-content-paragraphs-and-line-breaks" class = "anchor" href = "#paragraphs-and-line-breaks" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Paragraphs and Line Breaks< / h3 >
< p > A paragraph is simply one or more consecutive lines of text, separated
by one or more blank lines. (A blank line is any line that looks like a
blank line -- a line containing nothing but spaces or tabs is considered
blank.) Normal paragraphs should not be intended with spaces or tabs.< / p >
< p > The implication of the "one or more consecutive lines of text" rule is
that Markdown supports "hard-wrapped" text paragraphs. This differs
significantly from most other text-to-HTML formatters (including Movable
Type's "Convert Line Breaks" option) which translate every line break
character in a paragraph into a < code > < br /> < / code > tag.< / p >
< p > When you < em > do< / em > want to insert a < code > < br /> < / code > break tag using Markdown, you
end a line with two or more spaces, then type return.< / p >
< p > Yes, this takes a tad more effort to create a < code > < br /> < / code > , but a simplistic
"every line break is a < code > < br /> < / code > " rule wouldn't work for Markdown.
Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]
work best -- and look better -- when you format them with hard breaks.< / p >
< p > [bq]: #blockquote
[l]: #list< / p >
< h3 id = "user-content-header" > < a id = "user-content-headers-1" class = "anchor" href = "#headers-1" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Headers< / h3 >
< p > Markdown supports two styles of headers, < a href = "http://slashdot.org" > Setext< / a > and [atx] [2].< / p >
< p > Setext-style headers are "underlined" using equal signs (for first-level
headers) and dashes (for second-level headers). For example:< / p >
< pre > < code > This is an H1
=============
This is an H2
-------------
< / code > < / pre >
< p > Any number of underlining < code > =< / code > 's or < code > -< / code > 's will work.< / p >
< p > Atx-style headers use 1-6 hash characters at the start of the line,
corresponding to header levels 1-6. For example:< / p >
< pre > < code > # This is an H1
## This is an H2
###### This is an H6
< / code > < / pre >
< p > Optionally, you may "close" atx-style headers. This is purely
cosmetic -- you can use this if you think it looks better. The
closing hashes don't even need to match the number of hashes
used to open the header. (The number of opening hashes
determines the header level.) :< / p >
< pre > < code > # This is an H1 #
## This is an H2 ##
### This is an H3 ######
< / code > < / pre >
< h3 id = "user-content-blockquote" > < a id = "user-content-blockquotes-1" class = "anchor" href = "#blockquotes-1" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Blockquotes< / h3 >
< p > Markdown uses email-style < code > > < / code > characters for blockquoting. If you're
familiar with quoting passages of text in an email message, then you
know how to create a blockquote in Markdown. It looks best if you hard
wrap the text and put a < code > > < / code > before every line:< / p >
< pre > < code > > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
>
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
> id sem consectetuer libero luctus adipiscing.
< / code > < / pre >
< p > Markdown allows you to be lazy and only put the < code > > < / code > before the first
line of a hard-wrapped paragraph:< / p >
< pre > < code > > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
id sem consectetuer libero luctus adipiscing.
< / code > < / pre >
< p > Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
adding additional levels of < code > > < / code > :< / p >
< pre > < code > > This is the first level of quoting.
>
> > This is nested blockquote.
>
> Back to the first level.
< / code > < / pre >
< p > Blockquotes can contain other Markdown elements, including headers, lists,
and code blocks:< / p >
< pre > < code > > ## This is a header.
>
> 1. This is the first list item.
> 2. This is the second list item.
>
> Here's some example code:
>
> return shell_exec("echo $input | $markdown_script");
< / code > < / pre >
< p > Any decent text editor should make email-style quoting easy. For
example, with BBEdit, you can make a selection and choose Increase
Quote Level from the Text menu.< / p >
< h3 id = "user-content-list" > < a id = "user-content-lists-1" class = "anchor" href = "#lists-1" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Lists< / h3 >
< p > Markdown supports ordered (numbered) and unordered (bulleted) lists.< / p >
< p > Unordered lists use asterisks, pluses, and hyphens -- interchangably
-- as list markers:< / p >
< pre > < code > * Red
* Green
* Blue
< / code > < / pre >
< p > is equivalent to:< / p >
< pre > < code > + Red
+ Green
+ Blue
< / code > < / pre >
< p > and:< / p >
< pre > < code > - Red
- Green
- Blue
< / code > < / pre >
< p > Ordered lists use numbers followed by periods:< / p >
< pre > < code > 1. Bird
2. McHale
3. Parish
< / code > < / pre >
< p > It's important to note that the actual numbers you use to mark the
list have no effect on the HTML output Markdown produces. The HTML
Markdown produces from the above list is:< / p >
< pre > < code > < ol>
< li> Bird< /li>
< li> McHale< /li>
< li> Parish< /li>
< /ol>
< / code > < / pre >
< p > If you instead wrote the list in Markdown like this:< / p >
< pre > < code > 1. Bird
1. McHale
1. Parish
< / code > < / pre >
< p > or even:< / p >
< pre > < code > 3. Bird
1. McHale
8. Parish
< / code > < / pre >
< p > you'd get the exact same HTML output. The point is, if you want to,
you can use ordinal numbers in your ordered Markdown lists, so that
the numbers in your source match the numbers in your published HTML.
But if you want to be lazy, you don't have to.< / p >
< p > If you do use lazy list numbering, however, you should still start the
list with the number 1. At some point in the future, Markdown may support
starting ordered lists at an arbitrary number.< / p >
< p > List markers typically start at the left margin, but may be indented by
up to three spaces. List markers must be followed by one or more spaces
or a tab.< / p >
< p > To make lists look nice, you can wrap items with hanging indents:< / p >
< pre > < code > * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
viverra nec, fringilla in, laoreet vitae, risus.
* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.
< / code > < / pre >
< p > But if you want to be lazy, you don't have to:< / p >
< pre > < code > * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
viverra nec, fringilla in, laoreet vitae, risus.
* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.
< / code > < / pre >
< p > If list items are separated by blank lines, Markdown will wrap the
items in < code > < p> < / code > tags in the HTML output. For example, this input:< / p >
< pre > < code > * Bird
* Magic
< / code > < / pre >
< p > will turn into:< / p >
< pre > < code > < ul>
< li> Bird< /li>
< li> Magic< /li>
< /ul>
< / code > < / pre >
< p > But this:< / p >
< pre > < code > * Bird
* Magic
< / code > < / pre >
< p > will turn into:< / p >
< pre > < code > < ul>
< li> < p> Bird< /p> < /li>
< li> < p> Magic< /p> < /li>
< /ul>
< / code > < / pre >
< p > List items may consist of multiple paragraphs. Each subsequent
paragraph in a list item must be intended by either 4 spaces
or one tab:< / p >
< pre > < code > 1. This is a list item with two paragraphs. Lorem ipsum dolor
sit amet, consectetuer adipiscing elit. Aliquam hendrerit
mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet
vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
sit amet velit.
2. Suspendisse id sem consectetuer libero luctus adipiscing.
< / code > < / pre >
< p > It looks nice if you indent every line of the subsequent
paragraphs, but here again, Markdown will allow you to be
lazy:< / p >
< pre > < code > * This is a list item with two paragraphs.
This is the second paragraph in the list item. You're
only required to indent the first line. Lorem ipsum dolor
sit amet, consectetuer adipiscing elit.
* Another item in the same list.
< / code > < / pre >
< p > To put a blockquote within a list item, the blockquote's < code > > < / code >
delimiters need to be indented:< / p >
< pre > < code > * A list item with a blockquote:
> This is a blockquote
> inside a list item.
< / code > < / pre >
< p > To put a code block within a list item, the code block needs
to be indented < em > twice< / em > -- 8 spaces or two tabs:< / p >
< pre > < code > * A list item with a code block:
< code goes here>
< / code > < / pre >
< p > It's worth noting that it's possible to trigger an ordered list by
accident, by writing something like this:< / p >
< pre > < code > 1986. What a great season.
< / code > < / pre >
< p > In other words, a < em > number-period-space< / em > sequence at the beginning of a
line. To avoid this, you can backslash-escape the period:< / p >
< pre > < code > 1986\. What a great season.
< / code > < / pre >
< h3 id = "user-content-precode" > < a id = "user-content-code-blocks" class = "anchor" href = "#code-blocks" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Code Blocks< / h3 >
< p > 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 < code > < pre> < / code > and < code > < code> < / code > tags.< / p >
< p > 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:< / p >
< pre > < code > This is a normal paragraph:
This is a code block.
< / code > < / pre >
< p > Markdown will generate:< / p >
< pre > < code > < p> This is a normal paragraph:< /p>
< pre> < code> This is a code block.
< /code> < /pre>
< / code > < / pre >
< p > One level of indentation -- 4 spaces or 1 tab -- is removed from each
line of the code block. For example, this:< / p >
< pre > < code > Here is an example of AppleScript:
tell application "Foo"
beep
end tell
< / code > < / pre >
< p > will turn into:< / p >
< pre > < code > < p> Here is an example of AppleScript:< /p>
< pre> < code> tell application "Foo"
beep
end tell
< /code> < /pre>
< / code > < / pre >
< p > A code block continues until it reaches a line that is not indented
(or the end of the article).< / p >
< p > Within a code block, ampersands (< code > & < / code > ) and angle brackets (< code > < < / code > and < code > > < / code > )
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:< / p >
< pre > < code > < div class="footer">
& copy; 2004 Foo Corporation
< /div>
< / code > < / pre >
< p > will turn into:< / p >
< pre > < code > < pre> < code> & lt;div class="footer"& gt;
& amp;copy; 2004 Foo Corporation
& lt;/div& gt;
< /code> < /pre>
< / code > < / pre >
< p > 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.< / p >
< h3 id = "user-content-hr" > < a id = "user-content-horizontal-rules" class = "anchor" href = "#horizontal-rules" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Horizontal Rules< / h3 >
< p > You can produce a horizontal rule tag (< code > < hr /> < / code > ) 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:< / p >
< pre > < code > * * *
***
*****
- - -
---------------------------------------
_ _ _
< / code > < / pre >
< hr >
< h2 id = "user-content-span" > < a id = "user-content-span-elements" class = "anchor" href = "#span-elements" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Span Elements< / h2 >
< h3 id = "user-content-link" > < a id = "user-content-links-1" class = "anchor" href = "#links-1" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Links< / h3 >
< p > Markdown supports two style of links: < em > inline< / em > and < em > reference< / em > .< / p >
< p > In both styles, the link text is delimited by [square brackets].< / p >
< p > 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 < em > optional< / em >
title for the link, surrounded in quotes. For example:< / p >
< pre > < code > This is [an example](http://example.com/ "Title") inline link.
[This link](http://example.net/) has no title attribute.
< / code > < / pre >
< p > Will produce:< / p >
< pre > < code > < p> This is < a href="http://example.com/" title="Title">
an example< /a> inline link.< /p>
< p> < a href="http://example.net/"> This link< /a> has no
title attribute.< /p>
< / code > < / pre >
< p > If you're referring to a local resource on the same server, you can
use relative paths:< / p >
< pre > < code > See my [About](/about/) page for details.
< / code > < / pre >
< p > Reference-style links use a second set of square brackets, inside
which you place a label of your choosing to identify the link:< / p >
< pre > < code > This is [an example][id] reference-style link.
< / code > < / pre >
< p > You can optionally use a space to separate the sets of brackets:< / p >
< pre > < code > This is [an example] [id] reference-style link.
< / code > < / pre >
< p > Then, anywhere in the document, you define your link label like this,
on a line by itself:< / p >
< pre > < code > [id]: http://example.com/ "Optional Title Here"
< / code > < / pre >
< p > That is:< / p >
< ul >
< li > Square brackets containing the link identifier (optionally
indented from the left margin using up to three spaces);< / li >
< li > followed by a colon;< / li >
< li > followed by one or more spaces (or tabs);< / li >
< li > followed by the URL for the link;< / li >
< li > optionally followed by a title attribute for the link, enclosed
in double or single quotes.< / li >
< / ul >
< p > The link URL may, optionally, be surrounded by angle brackets:< / p >
< pre > < code > [id]: < http://example.com/> "Optional Title Here"
< / code > < / pre >
< p > 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:< / p >
< pre > < code > [id]: http://example.com/longish/path/to/resource/here
"Optional Title Here"
< / code > < / pre >
< p > Link definitions are only used for creating links during Markdown
processing, and are stripped from your document in the HTML output.< / p >
< p > Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are < em > not< / em > case sensitive. E.g. these two links:< / p >
< pre > < code > [link text][a]
[link text][A]
< / code > < / pre >
< p > are equivalent.< / p >
< p > The < em > implicit link name< / em > 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
"Google" to the google.com web site, you could simply write:< / p >
< pre > < code > [Google][]
< / code > < / pre >
< p > And then define the link:< / p >
< pre > < code > [Google]: http://google.com/
< / code > < / pre >
< p > Because link names may contain spaces, this shortcut even works for
multiple words in the link text:< / p >
< pre > < code > Visit [Daring Fireball][] for more information.
< / code > < / pre >
< p > And then define the link:< / p >
< pre > < code > [Daring Fireball]: http://daringfireball.net/
< / code > < / pre >
< p > 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.< / p >
< p > Here's an example of reference links in action:< / p >
< pre > < code > I get 10 times more traffic from [Google] [1] than from
[Yahoo] [2] or [MSN] [3].
[1]: http://google.com/ "Google"
[2]: http://search.yahoo.com/ "Yahoo Search"
[3]: http://search.msn.com/ "MSN Search"
< / code > < / pre >
< p > Using the implicit link name shortcut, you could instead write:< / p >
< pre > < code > I get 10 times more traffic from [Google][] than from
[Yahoo][] or [MSN][].
[google]: http://google.com/ "Google"
[yahoo]: http://search.yahoo.com/ "Yahoo Search"
[msn]: http://search.msn.com/ "MSN Search"
< / code > < / pre >
< p > Both of the above examples will produce the following HTML output:< / p >
< pre > < code > < p> I get 10 times more traffic from < a href="http://google.com/"
title="Google"> Google< /a> than from
< a href="http://search.yahoo.com/" title="Yahoo Search"> Yahoo< /a>
or < a href="http://search.msn.com/" title="MSN Search"> MSN< /a> .< /p>
< / code > < / pre >
< p > For comparison, here is the same paragraph written using
Markdown's inline link style:< / p >
< pre > < code > I get 10 times more traffic from [Google](http://google.com/ "Google")
than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
[MSN](http://search.msn.com/ "MSN Search").
< / code > < / pre >
< p > 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.< / p >
< p > 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.< / p >
< h3 id = "user-content-em" > < a id = "user-content-emphasis-1" class = "anchor" href = "#emphasis-1" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Emphasis< / h3 >
< p > Markdown treats asterisks (< code > *< / code > ) and underscores (< code > _< / code > ) as indicators of
emphasis. Text wrapped with one < code > *< / code > or < code > _< / code > will be wrapped with an
HTML < code > < em> < / code > tag; double < code > *< / code > 's or < code > _< / code > 's will be wrapped with an HTML
< code > < strong> < / code > tag. E.g., this input:< / p >
< pre > < code > *single asterisks*
_single underscores_
**double asterisks**
__double underscores__
< / code > < / pre >
< p > will produce:< / p >
< pre > < code > < em> single asterisks< /em>
< em> single underscores< /em>
< strong> double asterisks< /strong>
< strong> double underscores< /strong>
< / code > < / pre >
< p > 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.< / p >
< p > Emphasis can be used in the middle of a word:< / p >
< pre > < code > un*fucking*believable
< / code > < / pre >
< p > But if you surround an < code > *< / code > or < code > _< / code > with spaces, it'll be treated as a
literal asterisk or underscore.< / p >
< p > 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:< / p >
< pre > < code > \*this text is surrounded by literal asterisks\*
< / code > < / pre >
< h3 id = "user-content-code" > < a id = "user-content-code" class = "anchor" href = "#code" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Code< / h3 >
< p > To indicate a span of code, wrap it with backtick quotes (< code > `< / code > ).
Unlike a pre-formatted code block, a code span indicates code within a
normal paragraph. For example:< / p >
< pre > < code > Use the `printf()` function.
< / code > < / pre >
< p > will produce:< / p >
< pre > < code > < p> Use the < code> printf()< /code> function.< /p>
< / code > < / pre >
< p > To include a literal backtick character within a code span, you can use
multiple backticks as the opening and closing delimiters:< / p >
< pre > < code > ``There is a literal backtick (`) here.``
< / code > < / pre >
< p > which will produce this:< / p >
< pre > < code > < p> < code> There is a literal backtick (`) here.< /code> < /p>
< / code > < / pre >
< p > 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:< / p >
< pre > < code > A single backtick in a code span: `` ` ``
A backtick-delimited string in a code span: `` `foo` ``
< / code > < / pre >
< p > will produce:< / p >
< pre > < code > < p> A single backtick in a code span: < code> `< /code> < /p>
< p> A backtick-delimited string in a code span: < code> `foo`< /code> < /p>
< / code > < / pre >
< p > 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:< / p >
< pre > < code > Please don't use any `< blink> ` tags.
< / code > < / pre >
< p > into:< / p >
< pre > < code > < p> Please don't use any < code> & lt;blink& gt;< /code> tags.< /p>
< / code > < / pre >
< p > You can write this:< / p >
< pre > < code > `& #8212;` is the decimal-encoded equivalent of `& mdash;`.
< / code > < / pre >
< p > to produce:< / p >
< pre > < code > < p> < code> & amp;#8212;< /code> is the decimal-encoded
equivalent of < code> & amp;mdash;< /code> .< /p>
< / code > < / pre >
< h3 id = "user-content-img" > < a id = "user-content-images-1" class = "anchor" href = "#images-1" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Images< / h3 >
< p > Admittedly, it's fairly difficult to devise a "natural" syntax for
placing images into a plain text document format.< / p >
< p > Markdown uses an image syntax that is intended to resemble the syntax
for links, allowing for two styles: < em > inline< / em > and < em > reference< / em > .< / p >
< p > Inline image syntax looks like this:< / p >
< pre > < code > ![Alt text](/path/to/img.jpg)
![Alt text](/path/to/img.jpg "Optional title")
< / code > < / pre >
< p > That is:< / p >
< ul >
< li > An exclamation mark: < code > !< / code > ;< / li >
< li > followed by a set of square brackets, containing the < code > alt< / code >
attribute text for the image;< / li >
< li > followed by a set of parentheses, containing the URL or path to
the image, and an optional < code > title< / code > attribute enclosed in double
or single quotes.< / li >
< / ul >
< p > Reference-style image syntax looks like this:< / p >
< pre > < code > ![Alt text][id]
< / code > < / pre >
< p > Where "id" is the name of a defined image reference. Image references
are defined using syntax identical to link references:< / p >
< pre > < code > [id]: url/to/image "Optional title attribute"
< / code > < / pre >
< p > As of this writing, Markdown has no syntax for specifying the
dimensions of an image; if this is important to you, you can simply
use regular HTML < code > < img> < / code > tags.< / p >
< hr >
< h2 id = "user-content-misc" > < a id = "user-content-miscellaneous" class = "anchor" href = "#miscellaneous" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Miscellaneous< / h2 >
< h3 id = "user-content-autolink" > < a id = "user-content-automatic-links" class = "anchor" href = "#automatic-links" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Automatic Links< / h3 >
< p > Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:< / p >
< pre > < code > < http://example.com/>
< / code > < / pre >
< p > Markdown will turn this into:< / p >
< pre > < code > < a href="http://example.com/"> http://example.com/< /a>
< / code > < / pre >
< p > Automatic links for email addresses work similarly, except that
Markdown will also perform a bit of randomized decimal and hex
entity-encoding to help obscure your address from address-harvesting
spambots. For example, Markdown will turn this:< / p >
< pre > < code > < address@example.com>
< / code > < / pre >
< p > into something like this:< / p >
< pre > < code > < a href="& #x6D;& #x61;i& #x6C;& #x74;& #x6F;:& #x61;& #x64;& #x64;& #x72;& #x65;
& #115;& #115;& #64;& #101;& #120;& #x61;& #109;& #x70;& #x6C;e& #x2E;& #99;& #111;
& #109;"> & #x61;& #x64;& #x64;& #x72;& #x65;& #115;& #115;& #64;& #101;& #120;& #x61;
& #109;& #x70;& #x6C;e& #x2E;& #99;& #111;& #109;< /a>
< / code > < / pre >
< p > which will render in a browser as a clickable link to "< a href = "mailto:address@example.com" > address@example.com< / a > ".< / p >
< p > (This sort of entity-encoding trick will indeed fool many, if not
most, address-harvesting bots, but it definitely won't fool all of
them. It's better than nothing, but an address published in this way
will probably eventually start receiving spam.)< / p >
< h3 id = "user-content-backslash" > < a id = "user-content-backslash-escapes" class = "anchor" href = "#backslash-escapes" aria-hidden = "true" > < span class = "octicon octicon-link" > < / span > < / a > Backslash Escapes< / h3 >
< p > Markdown allows you to use backslash escapes 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 < code > < em> < / code > tag), you can backslashes
before the asterisks, like this:< / p >
< pre > < code > \*literal asterisks\*
< / code > < / pre >
< p > Markdown provides backslash escapes for the following characters:< / p >
< pre > < code > \ backslash
` backtick
* asterisk
_ underscore
{} curly braces
[] square brackets
() parentheses
# hash mark
+ plus sign
- minus sign (hyphen)
. dot
! exclamation mark
< / code > < / pre >
< p > Foo [bar][].< / p >
< p > Foo < a href = "/tylerlong/github-markdown-css-demo/blob/master/url" title = "Title with "quotes" inside" > bar< / a > .< / p >
< p > [bar]: /url/ "Title with "quotes" inside"< / p >
< p > This is the [simple case].< / p >
< p > [simple case]: /simple< / p >
< p > This one has a [line
break].< / p >
< p > This one has a [line
break] with a line-ending space.< / p >
< p > [line break]: /foo< / p >
< p > [this] [that] and the [other]< / p >
< p > [this]: /this
[that]: /that
[other]: /other< / p >
< p > Here's a simple block:< / p >
< div >
foo
< / div >
< p > This should be a code block, though:< / p >
< pre > < code > < div>
foo
< /div>
< / code > < / pre >
< p > As should this:< / p >
< pre > < code > < div> foo< /div>
< / code > < / pre >
< p > Now, nested:< / p >
< div >
< div >
< div >
foo
< / div >
< / div >
< / div >
< p > This should just be an HTML comment:< / p >
< p > Multiline:< / p >
< p > Code block:< / p >
< pre > < code > < !-- Comment -->
< / code > < / pre >
< p > Just plain comment, with trailing spaces on the line:< / p >
< p > Code:< / p >
< pre > < code > < hr />
< / code > < / pre >
< p > Hr's:< / p >
< hr >
< hr >
< hr >
< hr >
< hr >
< hr >
< hr id = "user-content-bar" >
< hr id = "user-content-bar" >
< hr id = "user-content-bar" >
2014-05-08 02:02:46 +08:00
2015-04-15 13:56:20 +08:00
< div class = "highlight highlight-js" > < pre > < span class = "pl-k" > var< / span > gulp < span class = "pl-k" > =< / span > < span class = "pl-c1" > require< / span > (< span class = "pl-s" > < span class = "pl-pds" > '< / span > gulp< span class = "pl-pds" > '< / span > < / span > );
< span class = "pl-k" > var< / span > myth < span class = "pl-k" > =< / span > < span class = "pl-c1" > require< / span > (< span class = "pl-s" > < span class = "pl-pds" > '< / span > gulp-myth< span class = "pl-pds" > '< / span > < / span > );
2014-05-08 02:02:46 +08:00
2015-04-15 13:56:20 +08:00
gulp.task(< span class = "pl-s" > < span class = "pl-pds" > '< / span > default< span class = "pl-pds" > '< / span > < / span > , < span class = "pl-k" > function< / span > () {
< span class = "pl-k" > return< / span > gulp.< span class = "pl-c1" > src< / span > (< span class = "pl-s" > < span class = "pl-pds" > '< / span > src/app.css< span class = "pl-pds" > '< / span > < / span > )
2014-11-27 23:20:18 +08:00
.pipe(myth())
2015-04-15 13:56:20 +08:00
.pipe(gulp.dest(< span class = "pl-s" > < span class = "pl-pds" > '< / span > dist< span class = "pl-pds" > '< / span > < / span > ));
2014-11-27 23:20:18 +08:00
});< / pre > < / div >
2014-05-08 02:02:46 +08:00
< / article >
2021-08-08 17:55:05 +08:00
< a class = "github-fork-ribbon" href = "https://github.com/sindresorhus/github-markdown-css" data-ribbon = "Fork me on GitHub" title = "Fork me on GitHub" > Fork me on GitHub< / a >
2014-05-08 02:02:46 +08:00
< / body >
< / html >