trace( "maybe this will work…" );
` tags. For example, If I were writing a tutorial on PHP and wanted to write about the function , I could do it using backticks. But, what if you want to write about a LOT of code? ## Code Block ## The other way to include code in Markdown is as a whole code block. In HTML, this translates to ... tags. To include a code block, simply indent the code by at least 4 spaces, or one tab. One level of indentatation will be removed from code blocks when they are translated to HTML. function sayHello():void{ trace("Hello!); } HTML characters and markdown characters will be properly escaped within code blocks (and within inline code), so you can just indent the original code, and it will come out exactly as you see it in plain text. As an example, * This list looks like Markdown syntax in an HTML page. * That's because Markdown isn't parsed between code blocks. * So, it's easy to use Markdown to write about Markdown. * Look, I can even include HTML Tags, and they will still be visible in an HTML page. # Links # There are two types of links in Markdown: Inline links Reference links. ## Inline Links ## Markdown inline links are equivalent to HTML `` links, they just have a different syntax. Links have the following format: [Link Text](url "Title") Link Text - The text that will appear on the HTML page. url - The url of the link. Title - The text that will appear when the user hovers over the link. This is an optional parameter. It is equivalent to the `title` attribute of an HTML link. Let's look at an example: [Visit my site](http://example.com "Visit example.com") The url can also be a relative url. For example, /about/ will go to the about page in the same domain as the current page. This is the same behavior as the HTML `href` attribute. Now try adding a link to your site. My website: ## Reference Links ## I love reference links. Markdown lets you define links by referencing the url of the link instead of hardcoding it into every occurrence of a link. This is the equivalent of using a variable to store a value in a programming language. Reference links make it easy to update urls when they change. You only have to change the referenced value, and all of the links that use it will magically update. This is the syntax for a reference link: The link: [Link Text][id] The reference: [id]: url "Title" Link Text - The text that will appear on the HTML page. id - The name of the reference. url - The url of the link. Title - The text that will appear when the user hovers over the link. This is an optional parameter. It is equivalent to the `title` attribute of an HTML link. First, add the link to your document as you normally would. Then, anywhere else in the document, add the reference line containing the actual url of the link. Let's look at an example for reference links: [URL]: http://example.com You should really [visit my site][My URL]. Let's talk about something else for awhile. Ok, now you really need to [visit my super awesome website][URL]. In the example, the url is referenced twice in the text. If you ever need to change the url of your site, you would only have to change the line with http://example.com for both links to point to your new site. 'URL' is the reference id for `http://example.com`. You can use anything that you want for the reference id. [Cats][Cat Site] are really awesome. I'm allergic to them, but I still like them. They make me all stuffy and teary whenever I pet them, but they are just so soft and fluffy. If you want to know more about cats, visit [this website that is dedicated to cats][Cat Site]. One thing to remember about reference links is that the reference id is NOT case-sensitive. So, don't try to define two links that only differ by a capital letter (that's bad practice anyway). Block Quotes Many people often have the need to reference somebody else's statements in their writing. Markdown makes this easy by using block quotes. Block quotes are denoted by a `>` (greater than) character before each line of the block quote. Let's look at an example: > Somebody said something mean about me. > I don't know who it was or what they said. > For some reason, I'm still trying to quote them using this Markdown block quote. You can have multiple paragraphs in a single block quote, just add a `>` before the beginning of each paragraph. > This is part of my first paragraph. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sed arcu est. Aliquam augue lorem, fringilla non sagittis a, eleifend at purus. Sed lectus mauris, semper interdum suscipit quis, aliquet vel diam. Cras a metus vitae ligula dignissim placerat. > This is part of my second paragraph. It is in the same block quote. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sed arcu est. Aliquam augue lorem, fringilla non sagittis a, eleifend at purus. Sed lectus mauris, semper interdum suscipit quis, aliquet vel diam. Cras a metus vitae ligula dignissim placerat. It is a common practice to put a `>` before each line as in the next block quote. This is purely for aesthetic purposes, as it makes the block quote more apparent in plain text. > This is a block quote where each line begins with a > character. The > sole purpose of this is to make the plain text document more readable. > You can be lazy and only indent the first line if you want. This > example also introduces nested block quotes: > > > **This is a nested block quote**. Nested block quotes are useful for > > conveying situations like, "Sandy told me that Sheila said that > > Pamela's sister wants to go to the dance with Johnny." > > This is part of the original block quote. Remember to add a blank line > between each nested block quote. Block quotes can also contain other Markdown elements, such as lists, headers, code blocks, etc. > ### A header in a block quote ### > // This is some PHP formatted as inline code This text has 3 levels of emphasis (it is bold and italicized) The first item in a list in a block quote Another list item Yet another list item The last list item. Visit my website using this Markdown link. Also note that block quotes in Markdown use the same syntax as email-style quotes. Images Yay! Finally some visuals. Unfortunately, images are included using plain text, so your document isn't going to look like it has pictures in it until it is output as HTML. Images look an awful lot like Markdown links, they just have an extra `!` (exclamation mark) in front of them. Here is the formal syntax:  Alt Text - The text that will appear on the HTML page. url - The url of the image. Title - The text that will appear when the user hovers over the image. This is an optional parameter. It is equivalent to the `title` attribute of an HTML image. For example, here is my logo formatted with Markdown syntax:  Now try adding your own image. If you don't have the url of an image on hand, try using `http://slekx.com/HelloWorld.png`) You can also use reference urls for images. This is the exact same as using reference links, but with a prepended `!` character. For example, this would be how to display my logo using a reference link. ![Slekx logo][id] [id]: http://slekx.com/wp-content/uploads/global/Logo.png "My Slekx Logo" You will find reference urls for images very useful if you reuse the same image throughout a single document. # Conclusion # Congratulations! You have completed **The Markdown Tutorial**. By now, you should have a solid grasp of Markdown syntax, as well as a nicely formatted Markdown reference for future use. As you may have noticed, I made a lot of references to writing *readable plain text*. One of the driving forces behind the Markdown syntax is the ability to read a document both as plain text and as HTML. You should be able to publish a Markdown document as-is, and people should be able to read it without having to sift through extra tags and formatting instructions. This is one of the biggest differences between Markdown an HTML. If you were wondering how much Markdown formatting you actually used throughout this tutorial, you created 11 headers, 6 paragraphs, 3 HTML breaks, more than 11 emphasized spans of text, 5 horizontal rules, 8 lists, 4 inline code spans, 4 code blocks, 3 links, and a block quote. To learn more about Markdown, visit this list of various Markdown implementations: [Markdown (Perl)](http://daringfireball.net/projects/markdown/) by John Gruber (This is the original Markdown implementation) [PHP Markdown](http://michelf.com/projects/php-markdown/) by Michel Fortin [Python Markdown](http://www.freewisdom.org/projects/python-markdown/) by Yuri Takteyev et al. [Showdown (Javascript)](http://attacklab.net/showdown/) by John Fraser [MarkdownJ (Java)](http://sourceforge.net/projects/markdownj/) by John Mutchek [Discount (C)](http://www.pell.portland.or.us/~orc/Code/discount/) by David Parsons [RDiscount (Ruby)](http://github.com/rtomayko/rdiscount) by Ryan Tomayko [Pandoc (Haskell)](http://johnmacfarlane.net/pandoc/) by John MacFarlane I hope that you found this tutorial useful. If you have any questions, suggestions, or additions to the implementation list, feel free to [contact me](http://slekx.com/contact/). Have a wonderful day! ### Legal stuff ### **The Markdown Tutorial** is licensed under the [Creative Commons Attribution 3.0 License](http://creativecommons.org/licenses/by/3.0/us/). Basically, that means you can do whatever you want with it, as long as you tell people that I wrote the original tutorial. For the actual legalities regarding this license, please visit the Creative Commons website.
...