1 markdown-mode Test Cases
2 ========================
9 - This is a bullet point.
10 - This is a sub bullet point.
11 - This is another bullet point.
15 1. This is an ordered list
16 2. With a second element.
17 44. And a forty-fourth element.
18 3. Remember, Markdown doesn't care which number you use.
20 List items with bold and italic:
22 > * This is a list item *in italics*, just a test.
23 > * *List item in italics.*
24 > * This is a list item **in bold**, just a test.
25 > * **List item in bold.**
27 Bold and italic phrases at the beginning of lines:
37 > of the blockquote mechanism
40 3. Two Inline Links on One Line
41 -------------------------------
43 *Contributed by Ryan Barrett on 2007-07-02*
45 thanks! the new version 1.4 works great. very cool.
47 i did notice a minor bug. if there are two inline links in the same line, e.g.
48 [foo](bar) baz [foo](bar), it colors the text between the links (baz) as well.
50 i'm guessing this is because the inline link regexp is greedy. if you switch
51 it to non-greedy - if elisp can do that - or to something like '\[[^]]+\]' if
52 not, that might do the trick.
63 5. Bold and Italics on the Same Line
64 ------------------------------------
66 *Contributed by Conal Elliott on 2007-08-27*
68 By the way, here are two syntax-highlighting glitches I've seen so far:
70 **foo and doo** or *ziddle zop*
71 Oh -- what's happening here?
74 6. Reverse Order Italic then Bold
75 ---------------------------------
77 Why doesn't the bold part get picked up?
78 *ziddle zop* or **foo and doo**
81 7. Two Inline Links in One Line
82 -------------------------------
84 *Contributed by Alastair Rankine on 2007-09-10*
86 Thanks for this, I have been waiting for an emacs markdown mode for ages!
88 One minor quibble is in the highlighting of inline links. As currently
89 (1.4) implemented the presence of a close paren on the same line as an
90 inline link will highlight the link and the subsequent text:
92 [blah](this bit will be highlighted) and so (will this bit)
94 I think this is because of greedy regexes. Here is a simple patch to address.
97 8. Reference-Style Link with a Space
98 ------------------------------------
100 Here's a [link] [1] with a space between the components.
102 [1]: http://daringfireball.net/projects/markdown/syntax
108 Single `backtick code` fragments as well as ``double`backtick`` fragments are
112 10. Single Underscore and Asterisk
113 ----------------------------------
115 This is a _ single underscore and a * single asterisk.
116 They should not trigger font locking.
119 11. Double Underscores and Asterisks
120 ------------------------------------
122 Neither should a double **asterisk and double__ underscore!
124 12. List-Like Strings in Preformatted Text
125 ------------------------------------------
127 To make lists look nice, you can wrap items with hanging indents:
129 * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
130 Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
131 viverra nec, fringilla in, laoreet vitae, risus.
132 * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
133 Suspendisse id sem consectetuer libero luctus adipiscing.
135 13. Multi-Line Italic and Bold
136 ------------------------------
138 bold **phrase spanning
139 two lines** asdf **same line** test
141 italic *phrase spanning
142 two lines* italic *same line* test
148 This document was created in GNU Emacs using [markdown-mode][]. It provides
149 syntax highlighting for [Markdown][] documents which allows reference-style
150 links like these. The reference definitions can even contain alternate
151 text such as [this one][id].
153 [markdown-mode]: http://jrblevin.freeshell.org/software/markdown-mode
154 [Markdown]: http://daringfireball.net/projects/markdown "Markdown Homepage"
155 [id]: http://reference-link.com/with/alt "Alternate Text"
161 ab \*literal asterisks\* asdf *inside \* literal asterisks* asd lkj
163 ab \**this should be italic\** yz
164 ab \**this should be italic*\* yz
165 ab *\*this should be italic\** yz
166 ab *\*this should be italic*\* yz
169 16. Single Letter and Word on Same Line
170 ---------------------------------------
172 a single **a** bold letter and bold word **test** asdf
173 a single _a_ italic letter and italic word _test_ asdf
174 a single __a__ bold letter and bold word __test__ asdf
175 a single *a* italic letter italic word *test* asdf
181 * An exclamation mark: `!`;
182 * followed by a set of square brackets, containing the `alt`
183 attribute text for the image;
186 18. Links in Preformatted Text
187 ------------------------------
189 Here's an example of reference links in action:
191 This document was created in GNU Emacs using [markdown-mode][]. It
192 provides syntax highlighting for [Markdown][] documents which allows
193 reference-style links like these. The reference definitions can even
194 contain alternate text such as [this one][id].
196 [markdown-mode]: http://jrblevin.freeshell.org/software/markdown-mode
197 [Markdown]: http://daringfireball.net/projects/markdown
198 [id]: http://reference-link.com/with/alt "Alternate Text"
201 19. Slash-Star in Preformatted Text
202 -----------------------------------
204 svn commit -m "Imported RCS project"
205 svn add image.png binaries/*
206 svn commit -m "Imported additional project files"
208 This text gets counted as part of the block quote too. But it can be ended
209 by a star-slash: */ It is as if `markdown-mode` is using C++ style comments.
211 Fixed by commit d81138d.
214 20. Underscores in Code Blocks
215 ------------------------------
217 *Contributed by shindo on 2008-01-20*
219 get_something_by_name()
222 21. Escaped Characters
223 ----------------------
225 Escaped backticks: \`not code\`
227 Escaped underscores: don't\_italicize\_this
229 Escaped asterisks: \*also not italic\*
232 \# This is not a heading
235 22. Adjacent Wiki Links
236 -----------------------
238 [[Two]] [[WikiLinks]] [[InARow]]
244 This is a test of "SmartyPants," a progrm written by John Gruber for
245 generating typographically correct HTML entities--ones such as
246 the em-dash and elipsis...
259 25. Asterisks and Underscores Across Blocks
260 -------------------------------------------
264 not match across* block boundaries.
268 not match across_ block boundaries.
270 Double Asterisks **should
272 not match across** block boundaries.
274 Double underscores __should
276 not match across__ block boundaries.
278 But, *this should still match*.
282 Addressed by commit d81138d.
285 26. Underscores Within Words
286 ----------------------------
288 Code fragments `can_have_underscores_inside_like` this.
291 27. Code Blocks Spanning Lines
292 ------------------------------
294 Markdown allows `code
295 fragments` to span across lines.
297 Let's make sure that ``double`
298 backtick`code fragments`` work
301 However, they should `not
303 match` across blocks.
305 Here's another `valid` one.
308 28. Pre Blocks and Nested Lists
309 -------------------------------
311 - List level 1 item 1
312 - List level 1 item 2
314 This is a second paragraph, part of item 2.
316 This nested pre block should match
320 Now we move back to the list.
322 - List level 1 item 3
324 - List level 2 item 1
328 - List level 2 item 2
330 - List level 3 item 1
335 29. Colon After Wiki Link
336 -------------------------
341 30. Incorrect Parsing of List Paragraph
342 ---------------------------------------
344 *Contributed by Luciano Gerber <garopaba_uk@yahoo.co.uk> on April 4, 2012.*
346 It is interesting to see what happens when one queries
347 `social upheaval` and `protopalatial era`.
349 * `social upheaval`: the follwing queries have been tried:
351 social upheaval subClassOf
353 The preceding text should not be matched as a preformatted block.
359 This is a footnote marker,[^1] but this is not.[^]
361 [^1]: And the definition of the footnote is here.
363 [^2]: but this is preformatted text.
366 32. Carat as Implicit Reference Link
367 ------------------------------------
369 This is a valid markdown link: [^][]
371 [^]: http://jblevins.org/ "And this is a valid reference defintion!"
374 33. Email Address Inside Bold and Italic Spans
375 ----------------------------------------------
377 *Lorem <ipsum@dolor.sit> amet.*
379 **Lorem <ipsum@dolor.sit> amet.**
382 34. URL Inside Bold and Italic Spans
383 ------------------------------------
385 *markdown-mode homepage http://jblevins.org/projects/markdown-mode/*
387 **markdown-mode homepage http://jblevins.org/projects/markdown-mode/**
389 35. Complex Preformatted Code Block
390 -----------------------------------
392 class Employee < ActiveRecord::Base
393 attr_accessible :github_username, :name
397 employee_sync = GitOrganized::GithubEmployeeSync.new(
398 GitOrganized::Organization.new(
399 GitOrganized.config.default_org,
400 ["employees-pull", "employees-push"]
406 rescue Github::Error::ServiceError => e
411 after_save do |employee| Employee.syncify! end
412 after_destroy do |employee| Employee.syncify! end
415 36. Fenced Code Blocks
416 ----------------------
418 Fenced code blocks begin with three or more tildes and end with a line
419 with at least as many tildes.
421 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
424 print '(a)', 'Hello, world!'
426 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
428 They may also have a `lang` attribute.
430 ~~~~~~~~~~~~~{: lang=fortran }
433 print '(a)', 'Hello, world!'
435 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
437 In Kramdown, one specifies the language identifier as follows:
442 print '(a)', 'Hello, world!'
446 or with a Maruku-style inline attribute list
451 print '(a)', 'Hello, world!'
454 {: .language-fortran}