Markdown syntax summary

Markdown is John Gruber of the design of a text markup system, compared to the html, it is very simple, easy to hand-write, and it supports WordPress , a wordpress plugin . Frogs decided to use vim, + Markdown to write the blog, it seems they were a powerful combination :)

First go to the official website of Vim download Markdown syntax highlighting plug-in , and copy it to ~ / .vim / syntax / directory. Then, create a ~ / .vim / ftdetect / mkd.vim "file, add the following:

"Markdown filetype file
if exists ("did_load_filetypes")
finish
endif
augroup markdown
au! BufRead, BufNewFile *. mkd setfiletype mkd
augroup the END

And in the "~ /. Vimrc" file, add the following:

"Markdown language syntax settings
augroup mkd
autocmd BufRead *. mkd set ai formatoptions = tcroqn2 comments = n:>
augroup the END

Then, the suffix "mkd" files can be automatically enabled for Markdown's syntax highlighting.

The following is a brief list of the Markdown syntax, ease of later reference. The following mainly from animal husbandry, yards Chi finishing to thank leninlee of hard work.

  • Link to add, there are three forms, and Markdown support for relative links.

    <Link>: This form is simply marked the link;
    [Text] (link "title"): add a link to the text, which title is optional;
    [Text] [mark]: add a link to the text links below to the beginning of a new line of [Mark] (usually at the end of the article) is given. Or directly to the [text] [] This form of writing, the following line to use the [text]: the link in the form of a statement link.

  • Picture add: with links than the picture just in front of more than an exclamation point "!"
  • The header format: Markdown provided the two kinds of ways.

    The first is a plus in the title in front of 6 "#" means "<h1> ~" <h6>, ".
    The second is a separate line in the heading, enter more than four of the equal sign "=" "<h1> enter more than four minus sign" - "to represent <h2>,.

  • Bold and italic: use an asterisk "*" or underscore "_"

    A italics;
    Two said in bold;
    Three said the bold italic.

  • Reference: is the html tag "<blockquote>, as long as the line first with the right angle bracket> on the line. If you want to nested reference, it is more than a few>.
  • Original output: If you do not want to the Markdown explain some of the content, there are two ways:

    The first is to escape the html the "<pre>" label: by adding at least 4 spaces or 1 tab width in front of the content is output;
    Second escape "<code>" tab with "` "(esc nod key): to output the contents of.

  • Unordered list: use an asterisk "*" in the text in front of the plus sign "+" minus sign "-" in any one pay attention to a space behind these symbols.
  • Ordered lists: the first before adding a number, followed by a period "." The first figure is, the list will start counting from 1.
  • The escape character: "\". Just give do not want to be escaped characters preceded by \.
  • HTML entities: If you want to output the content in a "<" or "&" symbol, you must use [HTML entity] [] instead. Markdown will the HTML special characters directly translated to HTML entities.
  • Newline: Markdown in a newline "<br/>, the end of the line more than two spaces marked in HTML.
  • Paragraph: between the two lines of a blank line, Markdown will recognize it as a paragraph.
    (Frog found in the time of writing this article, be sure to add a blank line in the list before, or else Markdown is not "*" recognized as a list.)
  • Horizontal line: the use of three or more "or" - "to represent. You can use the asterisk with the minus sign between the spaces, if the minus sign with no spaces.
    It must be in a separate paragraph, or else it will be recognized as a title.
  • Direct use of HTML tags: some Markdown does not support the label can directly write the HTML tags, such as a table.

the update ,2008-03-20: Frog effect directly to wordpress write Markdown format is really bad, but not convenient to edit the frog decided locally Markdown documentation converted to HTML format and then posted to the blog Shanghao.

About gfrog

gfrog, Coder. Canon 40D, Seagull 4B, Seagull 203, Blackberry 8100, Thinkpad, Debian Linux
This ENTRY was posted in the VIM and tagged . Bookmark the permalink .
  • Listen to the Provisional

    Yes, learning ...

    mac using TextMate to write MD's very comfortable ...

  • http://www.facebook.com/ Cassara

    Alright alighrt alright that's exactly what I needed!

  • http://yishanhe.net yish

    Learning, Thank you very much ~

  • tang also

    Share Xie Xiebo main.

  • Anonymous

    Summary is very easy to understand, Xie Xiebo main share.