mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-01-17 13:38:38 +01:00
Made the rendered text more readable.
I formatted the document so that the rendered page is more easily readable. (plus it also serves as even more of an example of how to use Markdown.) #meta
This commit is contained in:
parent
5d09566ee4
commit
84a1ae46c7
@ -2,45 +2,53 @@
|
|||||||
language: markdown
|
language: markdown
|
||||||
contributors:
|
contributors:
|
||||||
- ["Dan Turkel", "http://danturkel.com/"]
|
- ["Dan Turkel", "http://danturkel.com/"]
|
||||||
|
- ["Jacob Ward", "http://github.com/JacobCWard/"]
|
||||||
filename: markdown.md
|
filename: markdown.md
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
Markdown was created by John Gruber in 2004. It's meant to be an easy to read and write syntax which converts easily to HTML (and now many other formats as well).
|
Markdown was created by John Gruber in 2004. It's meant to be an easy to read and write syntax which converts easily to HTML (and now many other formats as well).
|
||||||
|
|
||||||
Give me as much feedback as you want! / Feel free to fork and pull request!
|
Markdown is a superset of HTML, so any HTML file is valid Markdown, that
|
||||||
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
<!-- Markdown is a superset of HTML, so any HTML file is valid Markdown. This
|
|
||||||
means we can use HTML elements in Markdown, such as the comment element, and
|
means we can use HTML elements in Markdown, such as the comment element, and
|
||||||
they won't be affected by a markdown parser. However, if you create an HTML
|
they won't be affected by a markdown parser. However, if you create an HTML
|
||||||
element in your markdown file, you cannot use markdown syntax within that
|
element in your markdown file, you cannot use markdown syntax within that
|
||||||
element's contents. -->
|
element's contents.
|
||||||
|
|
||||||
<!-- Markdown also varies in implementation from one parser to a next. This
|
Markdown also varies in implementation from one parser to a next. This
|
||||||
guide will attempt to clarify when features are universal or when they are
|
guide will attempt to clarify when features are universal or when they are
|
||||||
specific to a certain parser. -->
|
specific to a certain parser.
|
||||||
|
|
||||||
<!-- Headings -->
|
- [Headings](#headings)
|
||||||
<!-- You can create HTML elements <h1> through <h6> easily by prepending the
|
- [Simple Text Styles](#simple-text-styles)
|
||||||
text you want to be in that element by a number of hashes (#). -->
|
|
||||||
|
## Headings
|
||||||
|
|
||||||
|
You can create HTML elements `<h1>` through `<h6>` easily by prepending the
|
||||||
|
text you want to be in that element by a number of hashes (#).
|
||||||
|
|
||||||
|
```markdown
|
||||||
# This is an <h1>
|
# This is an <h1>
|
||||||
## This is an <h2>
|
## This is an <h2>
|
||||||
### This is an <h3>
|
### This is an <h3>
|
||||||
#### This is an <h4>
|
#### This is an <h4>
|
||||||
##### This is an <h5>
|
##### This is an <h5>
|
||||||
###### This is an <h6>
|
###### This is an <h6>
|
||||||
|
```
|
||||||
|
Markdown also provides us with two alternative ways of indicating h1 and h2.
|
||||||
|
|
||||||
<!-- Markdown also provides us with two alternative ways of indicating h1 and h2. -->
|
```markdown
|
||||||
This is an h1
|
This is an h1
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is an h2
|
This is an h2
|
||||||
-------------
|
-------------
|
||||||
|
```
|
||||||
|
## Simple text styles
|
||||||
|
|
||||||
<!-- Simple text styles -->
|
Text can be easily styled as italic or bold using markdown.
|
||||||
<!-- Text can be easily styled as italic or bold using markdown. -->
|
|
||||||
|
|
||||||
|
```markdown
|
||||||
*This text is in italics.*
|
*This text is in italics.*
|
||||||
_And so is this text._
|
_And so is this text._
|
||||||
|
|
||||||
@ -50,15 +58,20 @@ __And so is this text.__
|
|||||||
***This text is in both.***
|
***This text is in both.***
|
||||||
**_As is this!_**
|
**_As is this!_**
|
||||||
*__And this!__*
|
*__And this!__*
|
||||||
|
```
|
||||||
|
|
||||||
<!-- In Github Flavored Markdown, which is used to render markdown files on
|
In Github Flavored Markdown, which is used to render markdown files on
|
||||||
Github, we also have strikethrough: -->
|
Github, we also have strikethrough:
|
||||||
|
|
||||||
|
```markdown
|
||||||
~~This text is rendered with strikethrough.~~
|
~~This text is rendered with strikethrough.~~
|
||||||
|
```
|
||||||
|
## Paragraphs
|
||||||
|
|
||||||
<!-- Paragraphs are a one or multiple adjacent lines of text separated by one or
|
Paragraphs are a one or multiple adjacent lines of text separated by one or
|
||||||
multiple blank lines. -->
|
multiple blank lines.
|
||||||
|
|
||||||
|
```markdown
|
||||||
This is a paragraph. I'm typing in a paragraph isn't this fun?
|
This is a paragraph. I'm typing in a paragraph isn't this fun?
|
||||||
|
|
||||||
Now I'm in paragraph 2.
|
Now I'm in paragraph 2.
|
||||||
@ -66,16 +79,20 @@ I'm still in paragraph 2 too!
|
|||||||
|
|
||||||
|
|
||||||
I'm in paragraph three!
|
I'm in paragraph three!
|
||||||
|
```
|
||||||
|
|
||||||
<!-- Should you ever want to insert an HTML <br /> tag, you can end a paragraph
|
Should you ever want to insert an HTML <br /> tag, you can end a paragraph
|
||||||
with two or more spaces and then begin a new paragraph. -->
|
with two or more spaces and then begin a new paragraph.
|
||||||
|
|
||||||
|
```markdown
|
||||||
I end with two spaces (highlight me to see them).
|
I end with two spaces (highlight me to see them).
|
||||||
|
|
||||||
There's a <br /> above me!
|
There's a <br /> above me!
|
||||||
|
```
|
||||||
|
|
||||||
<!-- Block quotes are easy and done with the > character. -->
|
Block quotes are easy and done with the > character.
|
||||||
|
|
||||||
|
```markdown
|
||||||
> This is a block quote. You can either
|
> This is a block quote. You can either
|
||||||
> manually wrap your lines and put a `>` before every line or you can let your lines get really long and wrap on their own.
|
> manually wrap your lines and put a `>` before every line or you can let your lines get really long and wrap on their own.
|
||||||
> It doesn't make a difference so long as they start with a `>`.
|
> It doesn't make a difference so long as they start with a `>`.
|
||||||
@ -84,9 +101,12 @@ There's a <br /> above me!
|
|||||||
>> of indentation?
|
>> of indentation?
|
||||||
> How neat is that?
|
> How neat is that?
|
||||||
|
|
||||||
<!-- Lists -->
|
```
|
||||||
<!-- Unordered lists can be made using asterisks, pluses, or hyphens. -->
|
|
||||||
|
|
||||||
|
## Lists
|
||||||
|
Unordered lists can be made using asterisks, pluses, or hyphens.
|
||||||
|
|
||||||
|
```markdown
|
||||||
* Item
|
* Item
|
||||||
* Item
|
* Item
|
||||||
* Another item
|
* Another item
|
||||||
@ -102,159 +122,182 @@ or
|
|||||||
- Item
|
- Item
|
||||||
- Item
|
- Item
|
||||||
- One last item
|
- One last item
|
||||||
|
```
|
||||||
|
Ordered lists are done with a number followed by a period.
|
||||||
|
|
||||||
<!-- Ordered lists are done with a number followed by a period. -->
|
```markdown
|
||||||
|
|
||||||
1. Item one
|
1. Item one
|
||||||
2. Item two
|
2. Item two
|
||||||
3. Item three
|
3. Item three
|
||||||
|
```
|
||||||
|
|
||||||
<!-- You don't even have to label the items correctly and markdown will still
|
You don't even have to label the items correctly and markdown will still
|
||||||
render the numbers in order, but this may not be a good idea. -->
|
render the numbers in order, but this may not be a good idea.
|
||||||
|
|
||||||
|
```markdown
|
||||||
1. Item one
|
1. Item one
|
||||||
1. Item two
|
1. Item two
|
||||||
1. Item three
|
1. Item three
|
||||||
<!-- (This renders the same as the above example) -->
|
```
|
||||||
|
(This renders the same as the above example)
|
||||||
<!-- You can also use sublists. -->
|
|
||||||
|
|
||||||
|
You can also use sublists
|
||||||
|
```markdown
|
||||||
1. Item one
|
1. Item one
|
||||||
2. Item two
|
2. Item two
|
||||||
3. Item three
|
3. Item three
|
||||||
* Sub-item
|
* Sub-item
|
||||||
* Sub-item
|
* Sub-item
|
||||||
4. Item four
|
4. Item four
|
||||||
|
```
|
||||||
|
|
||||||
<!-- There are even task lists. This creates HTML checkboxes. -->
|
There are even task lists. This creates HTML checkboxes.
|
||||||
|
|
||||||
|
```markdown
|
||||||
Boxes below without the 'x' are unchecked HTML checkboxes.
|
Boxes below without the 'x' are unchecked HTML checkboxes.
|
||||||
- [ ] First task to complete.
|
- [ ] First task to complete.
|
||||||
- [ ] Second task that needs done
|
- [ ] Second task that needs done
|
||||||
This checkbox below will be a checked HTML checkbox.
|
This checkbox below will be a checked HTML checkbox.
|
||||||
- [x] This task has been completed
|
- [x] This task has been completed
|
||||||
|
```
|
||||||
|
|
||||||
<!-- Code blocks -->
|
## Code blocks
|
||||||
<!-- You can indicate a code block (which uses the <code> element) by indenting
|
|
||||||
a line with four spaces or a tab. -->
|
|
||||||
|
|
||||||
|
You can indicate a code block (which uses the `<code>` element) by indenting
|
||||||
|
a line with four spaces or a tab.
|
||||||
|
|
||||||
|
```markdown
|
||||||
This is code
|
This is code
|
||||||
So is this
|
So is this
|
||||||
|
```
|
||||||
|
|
||||||
<!-- You can also re-tab (or add an additional four spaces) for indentation
|
You can also re-tab (or add an additional four spaces) for indentation
|
||||||
inside your code. -->
|
inside your code
|
||||||
|
|
||||||
|
```markdown
|
||||||
my_array.each do |item|
|
my_array.each do |item|
|
||||||
puts item
|
puts item
|
||||||
end
|
end
|
||||||
|
```
|
||||||
|
|
||||||
<!-- Inline code can be created using the backtick character ` -->
|
Inline code can be created using the backtick character `
|
||||||
|
|
||||||
|
```markdown
|
||||||
John didn't even know what the `go_to()` function did!
|
John didn't even know what the `go_to()` function did!
|
||||||
|
```
|
||||||
|
|
||||||
<!-- In Github Flavored Markdown, you can use a special syntax for code. -->
|
In Github Flavored Markdown, you can use a special syntax for code
|
||||||
|
```markdown
|
||||||
\`\`\`ruby <!-- except remove those backslashes when you do this, just ```ruby ! -->
|
\`\`\`ruby <!-- except remove those backslashes when you do this, just ```ruby ! -->
|
||||||
def foobar
|
def foobar
|
||||||
puts "Hello world!"
|
puts "Hello world!"
|
||||||
end
|
end
|
||||||
\`\`\` <!-- here too, no backslashes, just ``` -->
|
\`\`\` <!-- here too, no backslashes, just ``` -->
|
||||||
|
```
|
||||||
|
|
||||||
<!-- The above text doesn't require indenting, plus Github will use syntax
|
The above text doesn't require indenting, plus Github will use syntax
|
||||||
highlighting of the language you specify after the ``` -->
|
highlighting of the language you specify after the \`\`\`
|
||||||
|
|
||||||
<!-- Horizontal rule (<hr />) -->
|
## Horizontal rule (`<hr/>`)
|
||||||
<!-- Horizontal rules are easily added with three or more asterisks or hyphens,
|
|
||||||
with or without spaces. -->
|
|
||||||
|
|
||||||
|
Horizontal rules are easily added with three or more asterisks or hyphens,
|
||||||
|
with or without spaces.
|
||||||
|
```markdown
|
||||||
***
|
***
|
||||||
---
|
---
|
||||||
- - -
|
- - -
|
||||||
****************
|
****************
|
||||||
|
```
|
||||||
|
|
||||||
<!-- Links -->
|
## Links
|
||||||
<!-- One of the best things about markdown is how easy it is to make links. Put
|
|
||||||
the text to display in hard brackets [] followed by the url in parentheses (). -->
|
|
||||||
|
|
||||||
|
One of the best things about markdown is how easy it is to make links. Put
|
||||||
|
the text to display in hard brackets [] followed by the url in parentheses ()
|
||||||
|
|
||||||
|
```markdown
|
||||||
[Click me!](http://test.com/)
|
[Click me!](http://test.com/)
|
||||||
|
```
|
||||||
<!-- You can also add a link title using quotes inside the parentheses. -->
|
You can also add a link title using quotes inside the parentheses.
|
||||||
|
```markdown
|
||||||
[Click me!](http://test.com/ "Link to Test.com")
|
[Click me!](http://test.com/ "Link to Test.com")
|
||||||
|
```
|
||||||
<!-- Relative paths work too. -->
|
Relative paths work too.
|
||||||
|
```markdown
|
||||||
[Go to music](/music/).
|
[Go to music](/music/).
|
||||||
|
```
|
||||||
<!-- Markdown also supports reference style links. -->
|
Markdown also supports reference style links.
|
||||||
|
```markdown
|
||||||
[Click this link][link1] for more info about it!
|
[Click this link][link1] for more info about it!
|
||||||
[Also check out this link][foobar] if you want to.
|
[Also check out this link][foobar] if you want to.
|
||||||
|
|
||||||
[link1]: http://test.com/ "Cool!"
|
[link1]: http://test.com/ "Cool!"
|
||||||
[foobar]: http://foobar.biz/ "Alright!"
|
[foobar]: http://foobar.biz/ "Alright!"
|
||||||
|
```
|
||||||
<!-- The title can also be in single quotes or in parentheses, or omitted
|
The title can also be in single quotes or in parentheses, or omitted
|
||||||
entirely. The references can be anywhere in your document and the reference IDs
|
entirely. The references can be anywhere in your document and the reference IDs
|
||||||
can be anything so long as they are unique. -->
|
can be anything so long as they are unique. -->
|
||||||
|
|
||||||
<!-- There is also "implicit naming" which lets you use the link text as the id. -->
|
There is also "implicit naming" which lets you use the link text as the id.
|
||||||
|
```markdown
|
||||||
[This][] is a link.
|
[This][] is a link.
|
||||||
|
|
||||||
[this]: http://thisisalink.com/
|
[this]: http://thisisalink.com/
|
||||||
|
```
|
||||||
|
But it's not that commonly used.
|
||||||
|
|
||||||
<!-- But it's not that commonly used. -->
|
## Images
|
||||||
|
Images are done the same way as links but with an exclamation point in front!
|
||||||
<!-- Images -->
|
```markdown
|
||||||
<!-- Images are done the same way as links but with an exclamation point in front! -->
|
|
||||||
|
|
||||||
![This is the alt-attribute for my image](http://imgur.com/myimage.jpg "An optional title")
|
![This is the alt-attribute for my image](http://imgur.com/myimage.jpg "An optional title")
|
||||||
|
```
|
||||||
<!-- And reference style works as expected. -->
|
And reference style works as expected.
|
||||||
|
```markdown
|
||||||
![This is the alt-attribute.][myimage]
|
![This is the alt-attribute.][myimage]
|
||||||
|
|
||||||
[myimage]: relative/urls/cool/image.jpg "if you need a title, it's here"
|
[myimage]: relative/urls/cool/image.jpg "if you need a title, it's here"
|
||||||
|
```
|
||||||
|
|
||||||
<!-- Miscellany -->
|
## Miscellany
|
||||||
<!-- Auto-links -->
|
### Auto-links
|
||||||
|
```markdown
|
||||||
<http://testwebsite.com/> is equivalent to
|
<http://testwebsite.com/> is equivalent to
|
||||||
[http://testwebsite.com/](http://testwebsite.com/)
|
[http://testwebsite.com/](http://testwebsite.com/)
|
||||||
|
```
|
||||||
|
|
||||||
<!-- Auto-links for emails -->
|
### Auto-links for emails
|
||||||
|
```markdown
|
||||||
<foo@bar.com>
|
<foo@bar.com>
|
||||||
|
```
|
||||||
|
|
||||||
<!-- Escaping characters -->
|
### Escaping characters
|
||||||
|
```markdown
|
||||||
I want to type *this text surrounded by asterisks* but I don't want it to be
|
I want to type *this text surrounded by asterisks* but I don't want it to be
|
||||||
in italics, so I do this: \*this text surrounded by asterisks\*.
|
in italics, so I do this: \*this text surrounded by asterisks\*.
|
||||||
|
```
|
||||||
|
|
||||||
<!-- Keyboard keys -->
|
### Keyboard keys
|
||||||
<!-- In Github Flavored Markdown, you can use a <kbd> tag to represent keyboard keys. -->
|
|
||||||
|
|
||||||
|
In Github Flavored Markdown, you can use a <kbd> tag to represent keyboard keys.
|
||||||
|
```markdown
|
||||||
Your computer crashed? Try sending a
|
Your computer crashed? Try sending a
|
||||||
<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Del</kbd>
|
<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Del</kbd>
|
||||||
|
```
|
||||||
|
### Tables
|
||||||
|
|
||||||
<!-- Tables -->
|
Tables are only available in Github Flavored Markdown and are slightly
|
||||||
<!-- Tables are only available in Github Flavored Markdown and are slightly
|
cumbersome, but if you really want it:
|
||||||
cumbersome, but if you really want it: -->
|
```markdown
|
||||||
|
|
||||||
| Col1 | Col2 | Col3 |
|
| Col1 | Col2 | Col3 |
|
||||||
| :----------- | :------: | ------------: |
|
| :----------- | :------: | ------------: |
|
||||||
| Left-aligned | Centered | Right-aligned |
|
| Left-aligned | Centered | Right-aligned |
|
||||||
| blah | blah | blah |
|
| blah | blah | blah |
|
||||||
|
```
|
||||||
|
or, for the same results
|
||||||
|
|
||||||
<!-- or, for the same results -->
|
```markdown
|
||||||
|
|
||||||
Col 1 | Col2 | Col3
|
Col 1 | Col2 | Col3
|
||||||
:-- | :-: | --:
|
:-- | :-: | --:
|
||||||
Ugh this is so ugly | make it | stop
|
Ugh this is so ugly | make it | stop
|
||||||
|
|
||||||
<!-- The end! -->
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
---
|
||||||
For more info, check out John Gruber's official post of syntax [here](http://daringfireball.net/projects/markdown/syntax) and Adam Pritchard's great cheatsheet [here](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
|
For more info, check out John Gruber's official post of syntax [here](http://daringfireball.net/projects/markdown/syntax) and Adam Pritchard's great cheatsheet [here](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user