沐风白桦

大圣休得胡闹

Markdown示例集锦

| Comments

代码块语法

``` [language] [title] [url] [link text]
code snippet
```

不使用语法高亮

```
$ git clone git@github.com:imathis/octopress.git # fork octopress
```
1
$ git clone git@github.com:imathis/octopress.git # fork octopress

使用语法高亮功能,并添加链接文字

``` ruby 查找素数 http://www.noulakaz.net/weblog/2007/03/18/a-regular-expression-to-check-for-prime-numbers/ 源码链接
class Fixnum
  def prime?
    ('1' * self) !~ /^1?$|^(11+?)\1+$/
  end
end
```
查找素数源码链接
1
2
3
4
5
class Fixnum
  def prime?
    ('1' * self) !~ /^1?$|^(11+?)\1+$/
  end
end

通过{% codeblock %}{% endcodeblock %}同样可以显示代码高亮

{% codeblock [lang:language] [title] [url] [link text] %}
code snippet
{% endcodeblock %}
{% codeblock lang:objc %}
[rectangle setX: 10 y: 10 width: 20 height: 20];
{% endcodeblock %}
1
[rectangle setX: 10 y: 10 width: 20 height: 20];
{% codeblock C#泛型 lang:csharp https://github.com/larryhou/XUPorter/blob/master/XCMod.cs 源码链接 %}
private T fetch<T>(string key) where T:new()
{
    if(_datastore != null && _datastore.Contains(key))
    {
        return (T)_datastore[key];
    }
    return new T();
}
{% endcodeblock %}
C#泛型源码链接
1
2
3
4
5
6
7
8
private T fetch<T>(string key) where T:new()
{
  if(_datastore != null &amp;&amp; _datastore.Contains(key))
  {
      return (T)_datastore[key];
  }
  return new T();
}

引用级别样式

> 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.

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.

> 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.

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.

> ## 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");

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");

清单

*   Red
*   Green
*   Blue
  • Red
  • Green
  • Blue
+   Red
+   Green
+   Blue
  • Red
  • Green
  • Blue
-   Red
-   Green
-   Blue
  • Red
  • Green
  • Blue
1.  Bird
2.  McHale
3.  Parish
  1. Bird
  2. McHale
  3. Parish
<ol>
<li>Bird</li>
<li>McHale</li>
<li>Parish</li>
</ol>
  1. Bird
  2. McHale
  3. Parish
1.  Bird
1.  McHale
1.  Parish
  1. Bird
  2. McHale
  3. Parish
3. Bird
1. McHale
8. Parish
  1. Bird
  2. McHale
  3. Parish
*   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.
  • 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.
*   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.
  • 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.
*   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.
  • 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.

*   A list item with a blockquote:

    > This is a blockquote
    > inside a list item.
  • A list item with a blockquote:

    This is a blockquote inside a list item.

Here is an example of AppleScript:

    tell application "Foo"
        beep
    end tell

Here is an example of AppleScript:

tell application "Foo"
    beep
end tell

Comments