File: test-cases.text

package info (click to toggle)
markdown-mode 2.3%2B154-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,052 kB
  • sloc: lisp: 13,081; makefile: 69; sh: 16
file content (454 lines) | stat: -rw-r--r-- 10,427 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
markdown-mode Test Cases
========================

1. Lists
--------

Unordered lists:

- This is a bullet point.
  - This is a sub bullet point.
- This is another bullet point.

Ordered lists:

1. This is an ordered list
2. With a second element.
44. And a forty-fourth element.
3. Remember, Markdown doesn't care which number you use.

List items with bold and italic:

> * This is a list item *in italics*, just a test.
> * *List item in italics.*
> * This is a list item **in bold**, just a test.
> * **List item in bold.**

Bold and italic phrases at the beginning of lines:

*not a list*
**also not a list**


2. Blockquotes
--------------

> this is a test
> of the blockquote mechanism


3. Two Inline Links on One Line
-------------------------------

*Contributed by Ryan Barrett on 2007-07-02*

thanks! the new version 1.4 works great. very cool.

i did notice a minor bug. if there are two inline links in the same line, e.g.
[foo](bar) baz [foo](bar), it colors the text between the links (baz) as well.

i'm guessing this is because the inline link regexp is greedy. if you switch
it to non-greedy - if elisp can do that - or to something like '\[[^]]+\]' if
not, that might do the trick.


4. Empty Inline Links
---------------------

[]()
[](asdf)
[asdf]()


5. Bold and Italics on the Same Line
------------------------------------

*Contributed by Conal Elliott on 2007-08-27*

By the way, here are two syntax-highlighting glitches I've seen so far:

**foo and doo** or *ziddle zop*
Oh -- what's happening here?


6. Reverse Order Italic then Bold
---------------------------------

Why doesn't the bold part get picked up?
*ziddle zop* or **foo and doo**


7. Two Inline Links in One Line
-------------------------------

*Contributed by Alastair Rankine on 2007-09-10*

Thanks for this, I have been waiting for an emacs markdown mode for ages!

One minor quibble is in the highlighting of inline links. As currently
(1.4) implemented the presence of a close paren on the same line as an
inline link will highlight the link and the subsequent text:

   [blah](this bit will be highlighted) and so (will this bit)

I think this is because of greedy regexes. Here is a simple patch to address.


8. Reference-Style Link with a Space
------------------------------------

Here's a [link] [1] with a space between the components.

 [1]: http://daringfireball.net/projects/markdown/syntax


9. Inline Code
--------------

Single `backtick code` fragments as well as ``double`backtick`` fragments are
supported.


10. Single Underscore and Asterisk
----------------------------------

This is a _ single underscore and a * single asterisk.
They should not trigger font locking.


11. Double Underscores and Asterisks
------------------------------------

Neither should a double **asterisk and double__ underscore!

12. List-Like Strings in Preformatted Text
------------------------------------------

To make lists look nice, you can wrap items with 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.

13. Multi-Line Italic and Bold
------------------------------

bold **phrase spanning
two lines** asdf **same line** test

italic *phrase spanning
two lines* italic *same line* test


14. Reference Links
-------------------

This document was created in GNU Emacs using [markdown-mode][].  It provides
syntax highlighting for [Markdown][] documents which allows reference-style
links like these.  The reference definitions can even contain alternate
text such as [this one][id].

 [markdown-mode]: http://jrblevin.freeshell.org/software/markdown-mode
 [Markdown]:      http://daringfireball.net/projects/markdown "Markdown Homepage"
 [id]:            http://reference-link.com/with/alt "Alternate Text"


15. Escaping
------------

ab \*literal asterisks\* asdf *inside \* literal asterisks* asd lkj

ab \**this should be italic\** yz  
ab \**this should be italic*\* yz  
ab *\*this should be italic\** yz  
ab *\*this should be italic*\* yz


16. Single Letter and Word on Same Line
---------------------------------------

a single **a** bold letter and bold word **test** asdf  
a single _a_ italic letter and italic word _test_ asdf  
a single __a__ bold letter and bold word __test__ asdf  
a single *a* italic letter italic word *test* asdf


17. Hanging Indents
-------------------

*   An exclamation mark: `!`;
*   followed by a set of square brackets, containing the `alt`
    attribute text for the image;


18. Links in Preformatted Text
------------------------------

Here's an example of reference links in action:

    This document was created in GNU Emacs using [markdown-mode][].  It
    provides syntax highlighting for [Markdown][] documents which allows
    reference-style links like these.  The reference definitions can even
    contain alternate text such as [this one][id].
    
     [markdown-mode]: http://jrblevin.freeshell.org/software/markdown-mode
     [Markdown]:      http://daringfireball.net/projects/markdown
     [id]:            http://reference-link.com/with/alt "Alternate Text"


19. Slash-Star in Preformatted Text
-----------------------------------

    svn commit -m "Imported RCS project"
    svn add image.png binaries/*
    svn commit -m "Imported additional project files"

This text gets counted as part of the block quote too.  But it can be ended
by a star-slash: */ It is as if `markdown-mode` is using C++ style comments.

Fixed by commit d81138d.


20. Underscores in Code Blocks
------------------------------

*Contributed by shindo on 2008-01-20*

    get_something_by_name()


21. Escaped Characters
----------------------

Escaped backticks: \`not code\`

Escaped underscores: don't\_italicize\_this

Escaped asterisks: \*also not italic\*

Escaped hash marks:  
\# This is not a heading


22. Adjacent Wiki Links
-----------------------

[[Two]] [[WikiLinks]] [[InARow]]


23. SmartyPants
---------------

This is a test of "SmartyPants," a progrm written by John Gruber for
generating typographically correct HTML entities--ones such as
the em-dash and elipsis...


24. Horizontal Rules
--------------------

* * * * *

- - - --- - - -

* *** * * *** * * *


25. Asterisks and Underscores Across Blocks
-------------------------------------------

Asterisks *should

not match across* block boundaries.

Underscores _should

not match across_ block boundaries.

Double Asterisks **should

not match across** block boundaries.

Double underscores __should

not match across__ block boundaries.

But, *this should still match*.

So should _this_.

Addressed by commit d81138d.


26. Underscores Within Words
----------------------------

Code fragments `can_have_underscores_inside_like` this.


27. Code Blocks Spanning Lines
------------------------------

Markdown allows `code
fragments` to span across lines.

Let's make sure that ``double`
backtick`code fragments`` work
this way too.

However, they should `not

match` across blocks.

Here's another `valid` one.


28. Pre Blocks and Nested Lists
-------------------------------

   - List level 1 item 1
   - List level 1 item 2

     This is a second paragraph, part of item 2.

         This nested pre block should match

             So should this

     Now we move back to the list.

   - List level 1 item 3

       - List level 2 item 1

             Nested pre block

       - List level 2 item 2

           - List level 3 item 1

                 Nested pre block


29. Colon After Wiki Link
-------------------------

[[AnotherLink]]:note


30. Incorrect Parsing of List Paragraph
---------------------------------------

*Contributed by Luciano Gerber <garopaba_uk@yahoo.co.uk> on April 4, 2012.*

It is interesting to see what happens when one queries
`social upheaval` and `protopalatial era`.

* `social upheaval`: the follwing queries have been tried:

    social upheaval subClassOf

The preceding text should not be matched as a preformatted block.


31. Footnotes
-------------

This is a footnote marker,[^1] but this is not.[^]

[^1]: And the definition of the footnote is here.

    [^2]: but this is preformatted text.


32. Carat as Implicit Reference Link
------------------------------------

This is a valid markdown link: [^][]

[^]: http://jblevins.org/ "And this is a valid reference defintion!"


33. Email Address Inside Bold and Italic Spans
----------------------------------------------

*Lorem <ipsum@dolor.sit> amet.*

**Lorem <ipsum@dolor.sit> amet.**


34. URL Inside Bold and Italic Spans
------------------------------------

*markdown-mode homepage http://jblevins.org/projects/markdown-mode/*

**markdown-mode homepage http://jblevins.org/projects/markdown-mode/**

35. Complex Preformatted Code Block
-----------------------------------

    class Employee < ActiveRecord::Base
      attr_accessible :github_username, :name
    
      def self.syncify!
        begin
          employee_sync = GitOrganized::GithubEmployeeSync.new(
            GitOrganized::Organization.new(
              GitOrganized.config.default_org,
              ["employees-pull", "employees-push"]
            ),
            Sources.new
          )
    
          employee_sync.sync
        rescue Github::Error::ServiceError => e
          retry
        end
      end
    
      after_save do |employee| Employee.syncify! end
      after_destroy do |employee| Employee.syncify! end
    end

36. Fenced Code Blocks
----------------------

Fenced code blocks begin with three or more tildes and end with a line
with at least as many tildes.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
program hello
  implicit none
  print '(a)', 'Hello, world!'
end program hello
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

They may also have a `lang` attribute.

~~~~~~~~~~~~~{: lang=fortran }
program hello
  implicit none
  print '(a)', 'Hello, world!'
end program hello
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In Kramdown, one specifies the language identifier as follows:

~~~ fortran
program hello
  implicit none
  print '(a)', 'Hello, world!'
end program hello
~~~

or with a Maruku-style inline attribute list

~~~
program hello
  implicit none
  print '(a)', 'Hello, world!'
end program hello
~~~
{: .language-fortran}