05_markdown.tests.rb
来自「用ruby on rails写的一个博客程序,还不错..ruby on rail」· RB 代码 · 共 1,528 行 · 第 1/3 页
RB
1,528 行
<p><img src="/path/img.jpg" alt="alt text"/></p>>>># Inline image with quoted alt text<<<--- Should become:<p><img src="/path/img.jpg" alt="the "alt text""/></p>>>># Reference image<<<![alt text][id][id]: /url/to/img.jpg "Title"--- Should become:<p><img src="/url/to/img.jpg" alt="alt text" title="Title"/></p>>>>### [Emphasis]# Emphasis (<em>) with asterisks<<<Use *single splats* for emphasis.--- Should become:<p>Use <em>single splats</em> for emphasis.</p>>>># Emphasis (<em>) with underscores<<<Use *underscores* for emphasis.--- Should become:<p>Use <em>underscores</em> for emphasis.</p>>>># Strong emphasis (<strong>) with asterisks<<<Use **double splats** for more emphasis.--- Should become:<p>Use <strong>double splats</strong> for more emphasis.</p>>>># Strong emphasis (<strong>) with underscores<<<Use __doubled underscores__ for more emphasis.--- Should become:<p>Use <strong>doubled underscores</strong> for more emphasis.</p>>>># Combined emphasis types 1<<<Use *single splats* or _single unders_ for normal emphasis.--- Should become:<p>Use <em>single splats</em> or <em>single unders</em> for normal emphasis.</p>>>># Combined emphasis types 2<<<Use _single unders_ for normal emphasisor __double them__ for strong emphasis.--- Should become:<p>Use <em>single unders</em> for normal emphasisor <strong>double them</strong> for strong emphasis.</p>>>># Emphasis containing escaped metachars<<<You can include literal *\*splats\** by escaping them.--- Should become:<p>You can include literal <em>*splats*</em> by escaping them.</p>>>># Two instances of asterisked emphasis on one line<<<If there's *two* splatted parts on a *single line* it should still work.--- Should become:<p>If there's <em>two</em> splatted parts on a <em>single line</em> it should still work.</p>>>> # Two instances of double asterisked emphasis on one line<<<This **doubled** one should **work too**.--- Should become:<p>This <strong>doubled</strong> one should <strong>work too</strong>.</p>>>> # Two instances of underscore emphasis on one line<<<If there's _two_ underbarred parts on a _single line_ it should still work.--- Should become:<p>If there's <em>two</em> underbarred parts on a <em>single line</em> it should still work.</p>>>> # Two instances of doubled underscore emphasis on one line<<<This __doubled__ one should __work too__.--- Should become:<p>This <strong>doubled</strong> one should <strong>work too</strong>.</p>>>> # Initial emphasis (asterisk)<<<*Something* like this should be bold.--- Should become:<p><em>Something</em> like this should be bold.</p>>>># Initial emphasis (underscore)<<<_Something_ like this should be bold.--- Should become:<p><em>Something</em> like this should be bold.</p>>>># Initial strong emphasis (asterisk)<<<**Something** like this should be bold.--- Should become:<p><strong>Something</strong> like this should be bold.</p>>>># Initial strong emphasis (underscore)<<<__Something__ like this should be bold.--- Should become:<p><strong>Something</strong> like this should be bold.</p>>>># Partial-word emphasis (Bug #568)<<<**E**xtended **TURN**--- Should become:<p><strong>E</strong>xtended <strong>TURN</strong></p>>>>### [Links]# Inline link, no title<<<An [example](http://url.com/).--- Should become:<p>An <a href="http://url.com/">example</a>.</p>>>># Inline link with title<<<An [example](http://url.com/ "Check out url.com!").--- Should become:<p>An <a href="http://url.com/" title="Check out url.com!">example</a>.</p>>>># Reference-style link, no title<<<An [example][ex] reference-style link.[ex]: http://www.bluefi.com/--- Should become:<p>An <a href="http://www.bluefi.com/">example</a> reference-style link.</p>>>># Reference-style link with quoted title<<<An [example][ex] reference-style link.[ex]: http://www.bluefi.com/ "Check out our air."--- Should become:<p>An <a href="http://www.bluefi.com/" title="Check out our air.">example</a> reference-style link.</p>>>># Reference-style link with paren title<<<An [example][ex] reference-style link.[ex]: http://www.bluefi.com/ (Check out our air.)--- Should become:<p>An <a href="http://www.bluefi.com/" title="Check out our air.">example</a> reference-style link.</p>>>># Reference-style link with one of each (hehe)<<<An [example][ex] reference-style link.[ex]: http://www.bluefi.com/ "Check out our air.)--- Should become:<p>An <a href="http://www.bluefi.com/" title="Check out our air.">example</a> reference-style link.</p>>>>" <- For syntax highlighting# Reference-style link with intervening space<<<You can split the [linked part] [ex] fromthe reference part with a single space.[ex]: http://www.treefrog.com/ "for some reason"--- Should become:<p>You can split the <a href="http://www.treefrog.com/" title="for some reason">linked part</a> fromthe reference part with a single space.</p>>>># Reference-style link with intervening space<<<You can split the [linked part] [ex] from the reference partwith a newline in case your editor wraps it there, I guess.[ex]: http://www.treefrog.com/--- Should become:<p>You can split the <a href="http://www.treefrog.com/">linked part</a> from the reference partwith a newline in case your editor wraps it there, I guess.</p>>>># Reference-style anchors<<<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"--- Should become:<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>>>># Implicit name-link shortcut anchors<<<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"--- Should become:<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>>>># Inline anchors<<<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").--- Should become:<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>>>># Graceful fail for unclosed brackets (and bug #524)<<<This is just a [bracket opener; it should fail gracefully.--- Should become:<p>This is just a [bracket opener; it should fail gracefully.</p>>>># Unresolved reference-style links (Bug #620)<<<This is an unresolved [url][1].--- Should become:<p>This is an unresolved [url][1].</p>>>>### [Auto-links]# Plain HTTP link<<<This is a reference to <http://www.FaerieMUD.org/>. You should follow it.--- Should become:<p>This is a reference to <a href="http://www.FaerieMUD.org/">http://www.FaerieMUD.org/</a>. You should follow it.</p>>>># FTP link<<<Why not download your very own chandelier from <ftp://ftp.usuc.edu/pub/foof/mir/>?--- Should become:<p>Why not download your very own chandelier from <a href="ftp://ftp.usuc.edu/pub/foof/mir/">ftp://ftp.usuc.edu/pub/foof/mir/</a>?</p>>>>### [Lists]# Unordered list<<<* Red* Green* Blue--- Should become:<ul><li>Red</li><li>Green</li><li>Blue</li></ul>>>># Unordered list w/alt bullets<<<- Red- Green- Blue--- Should become:<ul><li>Red</li><li>Green</li><li>Blue</li></ul>>>># Unordered list w/alt bullets 2<<<+ Red+ Green+ Blue--- Should become:<ul><li>Red</li><li>Green</li><li>Blue</li></ul>>>># Unordered list w/mixed bullets<<<+ Red- Green* Blue--- Should become:<ul><li>Red</li><li>Green</li><li>Blue</li></ul>>>># Ordered list<<<1. Bird2. McHale3. Parish--- Should become:<ol><li>Bird</li><li>McHale</li><li>Parish</li></ol>>>># Ordered list, any numbers<<<1. Bird1. McHale1. Parish--- Should become:<ol><li>Bird</li><li>McHale</li><li>Parish</li></ol>>>># Ordered list, any numbers 2<<<3. Bird1. McHale8. Parish--- Should become:<ol><li>Bird</li><li>McHale</li><li>Parish</li></ol>>>># Hanging indents<<<* 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.--- Should become:<ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,viverra nec, fringilla in, laoreet vitae, risus.</li><li>Donec sit amet nisl. Aliquam semper ipsum sit amet velit.Suspendisse id sem consectetuer libero luctus adipiscing.</li></ul>>>># Lazy indents<<<* 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.--- Should become:<ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,viverra nec, fringilla in, laoreet vitae, risus.</li><li>Donec sit amet nisl. Aliquam semper ipsum sit amet velit.Suspendisse id sem consectetuer libero luctus adipiscing.</li></ul>>>># Paragraph wrapped list items<<<* Bird* Magic--- Should become:<ul><li><p>Bird</p></li><li><p>Magic</p></li></ul>>>># Multi-paragraph list items<<<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.--- Should become:<ol><li><p>This is a list item with two paragraphs. Lorem ipsum dolorsit amet, consectetuer adipiscing elit. Aliquam hendreritmi posuere lectus.</p><p>Vestibulum enim wisi, viverra nec, fringilla in, laoreetvitae, risus. Donec sit amet nisl. Aliquam semper ipsumsit amet velit.</p></li><li><p>Suspendisse id sem consectetuer libero luctus adipiscing.</p></li></ol>>>># Lazy multi-paragraphs<<<* This is a list item with two paragraphs. This is the second paragraph in the list item. You'reonly required to indent the first line. Lorem ipsum dolorsit amet, consectetuer adipiscing elit.* Another item in the same list.--- Should become:<ul><li><p>This is a list item with two paragraphs.</p><p>This is the second paragraph in the list item. You'reonly required to indent the first line. Lorem ipsum dolorsit amet, consectetuer adipiscing elit.</p></li><li><p>Another item in the same list.</p></li></ul>>>># Blockquote in list item<<<* A list item with a blockquote: > This is a blockquote > inside a list item.--- Should become:<ul><li><p>A list item with a blockquote:</p><blockquote> <p>This is a blockquote inside a list item.</p></blockquote></li></ul>>>># Code block in list item<<<* A list item with a code block: <code goes here>--- Should become:<ul><li><p>A list item with a code block:</p><pre><code><code goes here></code></pre></li></ul>>>># Backslash-escaped number-period-space<<<1986\. What a great season.--- Should become:<p>1986. What a great season.</p>>>>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?