test-cases.text (10430B)
1 markdown-mode Test Cases 2 ======================== 3 4 1. Lists 5 -------- 6 7 Unordered lists: 8 9 - This is a bullet point. 10 - This is a sub bullet point. 11 - This is another bullet point. 12 13 Ordered lists: 14 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. 19 20 List items with bold and italic: 21 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.** 26 27 Bold and italic phrases at the beginning of lines: 28 29 *not a list* 30 **also not a list** 31 32 33 2. Blockquotes 34 -------------- 35 36 > this is a test 37 > of the blockquote mechanism 38 39 40 3. Two Inline Links on One Line 41 ------------------------------- 42 43 *Contributed by Ryan Barrett on 2007-07-02* 44 45 thanks! the new version 1.4 works great. very cool. 46 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. 49 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. 53 54 55 4. Empty Inline Links 56 --------------------- 57 58 []() 59 [](asdf) 60 [asdf]() 61 62 63 5. Bold and Italics on the Same Line 64 ------------------------------------ 65 66 *Contributed by Conal Elliott on 2007-08-27* 67 68 By the way, here are two syntax-highlighting glitches I've seen so far: 69 70 **foo and doo** or *ziddle zop* 71 Oh -- what's happening here? 72 73 74 6. Reverse Order Italic then Bold 75 --------------------------------- 76 77 Why doesn't the bold part get picked up? 78 *ziddle zop* or **foo and doo** 79 80 81 7. Two Inline Links in One Line 82 ------------------------------- 83 84 *Contributed by Alastair Rankine on 2007-09-10* 85 86 Thanks for this, I have been waiting for an emacs markdown mode for ages! 87 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: 91 92 [blah](this bit will be highlighted) and so (will this bit) 93 94 I think this is because of greedy regexes. Here is a simple patch to address. 95 96 97 8. Reference-Style Link with a Space 98 ------------------------------------ 99 100 Here's a [link] [1] with a space between the components. 101 102 [1]: http://daringfireball.net/projects/markdown/syntax 103 104 105 9. Inline Code 106 -------------- 107 108 Single `backtick code` fragments as well as ``double`backtick`` fragments are 109 supported. 110 111 112 10. Single Underscore and Asterisk 113 ---------------------------------- 114 115 This is a _ single underscore and a * single asterisk. 116 They should not trigger font locking. 117 118 119 11. Double Underscores and Asterisks 120 ------------------------------------ 121 122 Neither should a double **asterisk and double__ underscore! 123 124 12. List-Like Strings in Preformatted Text 125 ------------------------------------------ 126 127 To make lists look nice, you can wrap items with hanging indents: 128 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. 134 135 13. Multi-Line Italic and Bold 136 ------------------------------ 137 138 bold **phrase spanning 139 two lines** asdf **same line** test 140 141 italic *phrase spanning 142 two lines* italic *same line* test 143 144 145 14. Reference Links 146 ------------------- 147 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]. 152 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" 156 157 158 15. Escaping 159 ------------ 160 161 ab \*literal asterisks\* asdf *inside \* literal asterisks* asd lkj 162 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 167 168 169 16. Single Letter and Word on Same Line 170 --------------------------------------- 171 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 176 177 178 17. Hanging Indents 179 ------------------- 180 181 * An exclamation mark: `!`; 182 * followed by a set of square brackets, containing the `alt` 183 attribute text for the image; 184 185 186 18. Links in Preformatted Text 187 ------------------------------ 188 189 Here's an example of reference links in action: 190 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]. 195 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" 199 200 201 19. Slash-Star in Preformatted Text 202 ----------------------------------- 203 204 svn commit -m "Imported RCS project" 205 svn add image.png binaries/* 206 svn commit -m "Imported additional project files" 207 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. 210 211 Fixed by commit d81138d. 212 213 214 20. Underscores in Code Blocks 215 ------------------------------ 216 217 *Contributed by shindo on 2008-01-20* 218 219 get_something_by_name() 220 221 222 21. Escaped Characters 223 ---------------------- 224 225 Escaped backticks: \`not code\` 226 227 Escaped underscores: don't\_italicize\_this 228 229 Escaped asterisks: \*also not italic\* 230 231 Escaped hash marks: 232 \# This is not a heading 233 234 235 22. Adjacent Wiki Links 236 ----------------------- 237 238 [[Two]] [[WikiLinks]] [[InARow]] 239 240 241 23. SmartyPants 242 --------------- 243 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 ellipsis... 247 248 249 24. Horizontal Rules 250 -------------------- 251 252 * * * * * 253 254 - - - --- - - - 255 256 * *** * * *** * * * 257 258 259 25. Asterisks and Underscores Across Blocks 260 ------------------------------------------- 261 262 Asterisks *should 263 264 not match across* block boundaries. 265 266 Underscores _should 267 268 not match across_ block boundaries. 269 270 Double Asterisks **should 271 272 not match across** block boundaries. 273 274 Double underscores __should 275 276 not match across__ block boundaries. 277 278 But, *this should still match*. 279 280 So should _this_. 281 282 Addressed by commit d81138d. 283 284 285 26. Underscores Within Words 286 ---------------------------- 287 288 Code fragments `can_have_underscores_inside_like` this. 289 290 291 27. Code Blocks Spanning Lines 292 ------------------------------ 293 294 Markdown allows `code 295 fragments` to span across lines. 296 297 Let's make sure that ``double` 298 backtick`code fragments`` work 299 this way too. 300 301 However, they should `not 302 303 match` across blocks. 304 305 Here's another `valid` one. 306 307 308 28. Pre Blocks and Nested Lists 309 ------------------------------- 310 311 - List level 1 item 1 312 - List level 1 item 2 313 314 This is a second paragraph, part of item 2. 315 316 This nested pre block should match 317 318 So should this 319 320 Now we move back to the list. 321 322 - List level 1 item 3 323 324 - List level 2 item 1 325 326 Nested pre block 327 328 - List level 2 item 2 329 330 - List level 3 item 1 331 332 Nested pre block 333 334 335 29. Colon After Wiki Link 336 ------------------------- 337 338 [[AnotherLink]]:note 339 340 341 30. Incorrect Parsing of List Paragraph 342 --------------------------------------- 343 344 *Contributed by Luciano Gerber <garopaba_uk@yahoo.co.uk> on April 4, 2012.* 345 346 It is interesting to see what happens when one queries 347 `social upheaval` and `protopalatial era`. 348 349 * `social upheaval`: the following queries have been tried: 350 351 social upheaval subClassOf 352 353 The preceding text should not be matched as a preformatted block. 354 355 356 31. Footnotes 357 ------------- 358 359 This is a footnote marker,[^1] but this is not.[^] 360 361 [^1]: And the definition of the footnote is here. 362 363 [^2]: but this is preformatted text. 364 365 366 32. Carat as Implicit Reference Link 367 ------------------------------------ 368 369 This is a valid markdown link: [^][] 370 371 [^]: http://jblevins.org/ "And this is a valid reference definition!" 372 373 374 33. Email Address Inside Bold and Italic Spans 375 ---------------------------------------------- 376 377 *Lorem <ipsum@dolor.sit> amet.* 378 379 **Lorem <ipsum@dolor.sit> amet.** 380 381 382 34. URL Inside Bold and Italic Spans 383 ------------------------------------ 384 385 *markdown-mode homepage http://jblevins.org/projects/markdown-mode/* 386 387 **markdown-mode homepage http://jblevins.org/projects/markdown-mode/** 388 389 35. Complex Preformatted Code Block 390 ----------------------------------- 391 392 class Employee < ActiveRecord::Base 393 attr_accessible :github_username, :name 394 395 def self.syncify! 396 begin 397 employee_sync = GitOrganized::GithubEmployeeSync.new( 398 GitOrganized::Organization.new( 399 GitOrganized.config.default_org, 400 ["employees-pull", "employees-push"] 401 ), 402 Sources.new 403 ) 404 405 employee_sync.sync 406 rescue Github::Error::ServiceError => e 407 retry 408 end 409 end 410 411 after_save do |employee| Employee.syncify! end 412 after_destroy do |employee| Employee.syncify! end 413 end 414 415 36. Fenced Code Blocks 416 ---------------------- 417 418 Fenced code blocks begin with three or more tildes and end with a line 419 with at least as many tildes. 420 421 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 422 program hello 423 implicit none 424 print '(a)', 'Hello, world!' 425 end program hello 426 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 427 428 They may also have a `lang` attribute. 429 430 ~~~~~~~~~~~~~{: lang=fortran } 431 program hello 432 implicit none 433 print '(a)', 'Hello, world!' 434 end program hello 435 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 436 437 In Kramdown, one specifies the language identifier as follows: 438 439 ~~~ fortran 440 program hello 441 implicit none 442 print '(a)', 'Hello, world!' 443 end program hello 444 ~~~ 445 446 or with a Maruku-style inline attribute list 447 448 ~~~ 449 program hello 450 implicit none 451 print '(a)', 'Hello, world!' 452 end program hello 453 ~~~ 454 {: .language-fortran}