├── .gitignore ├── doc ├── todo.md └── broken.md ├── .npmignore ├── test ├── new │ ├── escaped_angles.text │ ├── escaped_angles.html │ ├── gfm_del.text │ ├── not_a_link.text │ ├── lazy_blockquotes.text │ ├── gfm_del.html │ ├── not_a_link.html │ ├── same_bullet.text │ ├── gfm_em.text │ ├── nested_code.text │ ├── nested_square_link.text │ ├── ref_paren.text │ ├── case_insensitive_refs.html │ ├── case_insensitive_refs.text │ ├── nested_code.html │ ├── autolink_lines.text │ ├── gfm_em.html │ ├── ref_paren.html │ ├── gfm_break.breaks.text │ ├── nested_em.text │ ├── gfm_break.breaks.html │ ├── gfm_links.text │ ├── list_item_text.text │ ├── hr_list_break.text │ ├── nested_square_link.html │ ├── lazy_blockquotes.html │ ├── same_bullet.html │ ├── list_item_text.html │ ├── blockquote_list_item.text │ ├── autolink_lines.html │ ├── nested_em.html │ ├── gfm_links.html │ ├── hr_list_break.html │ ├── blockquote_list_item.html │ ├── text.smartypants.text │ ├── text.smartypants.html │ ├── tricky_list.text │ ├── def_blocks.text │ ├── double_link.text │ ├── double_link.html │ ├── gfm_code.text │ ├── gfm_code.html │ ├── def_blocks.html │ ├── tricky_list.html │ ├── loose_lists.text │ ├── toplevel_paragraphs.gfm.text │ ├── gfm_tables.text │ ├── toplevel_paragraphs.gfm.html │ ├── gfm_code_hr_list.text │ ├── loose_lists.html │ ├── gfm_code_hr_list.html │ ├── main.text │ ├── main.html │ └── gfm_tables.html ├── tests │ ├── escaped_angles.text │ ├── escaped_angles.html │ ├── gfm_del.text │ ├── not_a_link.text │ ├── lazy_blockquotes.text │ ├── not_a_link.html │ ├── gfm_del.html │ ├── nested_code.text │ ├── ref_paren.text │ ├── same_bullet.text │ ├── case_insensitive_refs.text │ ├── gfm_em.text │ ├── nested_square_link.text │ ├── autolink_lines.text │ ├── case_insensitive_refs.html │ ├── gfm_em.html │ ├── nested_code.html │ ├── ref_paren.html │ ├── gfm_break.breaks.text │ ├── nested_blockquotes.text │ ├── gfm_break.breaks.html │ ├── list_item_text.text │ ├── nested_em.text │ ├── gfm_links.text │ ├── nested_square_link.html │ ├── hr_list_break.text │ ├── lazy_blockquotes.html │ ├── same_bullet.html │ ├── list_item_text.html │ ├── blockquote_list_item.text │ ├── autolink_lines.html │ ├── tidyness.text │ ├── nested_em.html │ ├── gfm_links.html │ ├── blockquote_list_item.html │ ├── hr_list_break.html │ ├── strong_and_em_together.text │ ├── literal_quotes_in_titles.text │ ├── nested_blockquotes.html │ ├── text.smartypants.text │ ├── tidyness.html │ ├── text.smartypants.html │ ├── code_spans.text │ ├── literal_quotes_in_titles.html │ ├── blockquotes_with_code_blocks.text │ ├── tricky_list.text │ ├── def_blocks.text │ ├── double_link.text │ ├── inline_html_advanced.text │ ├── inline_html_comments.text │ ├── inline_html_advanced.html │ ├── strong_and_em_together.html │ ├── code_spans.html │ ├── inline_html_comments.html │ ├── code_blocks.text │ ├── hard_wrapped_paragraphs_with_list_like_lines.nogfm.text │ ├── double_link.html │ ├── hard_wrapped_paragraphs_with_list_like_lines.nogfm.html │ ├── blockquotes_with_code_blocks.html │ ├── gfm_code.text │ ├── links_shortcut_references.html │ ├── auto_links.text │ ├── links_shortcut_references.text │ ├── gfm_code.html │ ├── def_blocks.html │ ├── code_blocks.html │ ├── links_inline_style.text │ ├── tabs.text │ ├── tricky_list.html │ ├── amps_and_angles_encoding.text │ ├── loose_lists.text │ ├── tabs.html │ ├── toplevel_paragraphs.gfm.text │ ├── links_inline_style.html │ ├── horizontal_rules.text │ ├── gfm_tables.text │ ├── amps_and_angles_encoding.html │ ├── auto_links.html │ ├── toplevel_paragraphs.gfm.html │ ├── horizontal_rules.html │ ├── gfm_code_hr_list.text │ ├── inline_html_simple.text │ ├── loose_lists.html │ ├── gfm_code_hr_list.html │ ├── inline_html_simple.html │ ├── links_reference_style.text │ ├── main.text │ ├── main.html │ ├── links_reference_style.html │ ├── gfm_tables.html │ ├── ordered_and_unordered_lists.text │ ├── backslash_escapes.text │ ├── backslash_escapes.html │ ├── ordered_and_unordered_lists.html │ ├── markdown_documentation_basics.text │ └── markdown_documentation_basics.html ├── original │ ├── nested_blockquotes.text │ ├── tidyness.text │ ├── strong_and_em_together.text │ ├── literal_quotes_in_titles.text │ ├── nested_blockquotes.html │ ├── tidyness.html │ ├── literal_quotes_in_titles.html │ ├── code_spans.text │ ├── blockquotes_with_code_blocks.text │ ├── inline_html_advanced.text │ ├── inline_html_comments.text │ ├── code_spans.html │ ├── inline_html_advanced.html │ ├── strong_and_em_together.html │ ├── hard_wrapped_paragraphs_with_list_like_lines.text │ ├── inline_html_comments.html │ ├── code_blocks.text │ ├── hard_wrapped_paragraphs_with_list_like_lines.html │ ├── blockquotes_with_code_blocks.html │ ├── links_shortcut_references.html │ ├── auto_links.text │ ├── links_shortcut_references.text │ ├── code_blocks.html │ ├── links_inline_style.text │ ├── tabs.text │ ├── amps_and_angles_encoding.text │ ├── tabs.html │ ├── links_inline_style.html │ ├── amps_and_angles_encoding.html │ ├── horizontal_rules.text │ ├── auto_links.html │ ├── horizontal_rules.html │ ├── inline_html_simple.text │ ├── inline_html_simple.html │ ├── links_reference_style.text │ ├── links_reference_style.html │ ├── ordered_and_unordered_lists.text │ ├── backslash_escapes.text │ ├── backslash_escapes.html │ ├── ordered_and_unordered_lists.html │ ├── markdown_documentation_basics.text │ └── markdown_documentation_basics.html ├── browser │ ├── index.html │ ├── index.js │ └── test.js ├── README └── index.js ├── index.js ├── .travis.yml ├── Makefile ├── component.json ├── bower.json ├── package.json ├── LICENSE ├── man └── marked.1 ├── bin └── marked ├── README.md └── marked.min.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /doc/todo.md: -------------------------------------------------------------------------------- 1 | # Todo 2 | 3 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .git* 2 | test/ 3 | -------------------------------------------------------------------------------- /test/new/escaped_angles.text: -------------------------------------------------------------------------------- 1 | \> 2 | -------------------------------------------------------------------------------- /test/tests/escaped_angles.text: -------------------------------------------------------------------------------- 1 | \> 2 | -------------------------------------------------------------------------------- /test/new/escaped_angles.html: -------------------------------------------------------------------------------- 1 |
>
2 | -------------------------------------------------------------------------------- /test/tests/escaped_angles.html: -------------------------------------------------------------------------------- 1 |>
2 | -------------------------------------------------------------------------------- /test/new/gfm_del.text: -------------------------------------------------------------------------------- 1 | hello ~~hi~~ world 2 | -------------------------------------------------------------------------------- /test/new/not_a_link.text: -------------------------------------------------------------------------------- 1 | \[test](not a link) 2 | -------------------------------------------------------------------------------- /test/tests/gfm_del.text: -------------------------------------------------------------------------------- 1 | hello ~~hi~~ world 2 | -------------------------------------------------------------------------------- /test/new/lazy_blockquotes.text: -------------------------------------------------------------------------------- 1 | > hi there 2 | bud 3 | -------------------------------------------------------------------------------- /test/tests/not_a_link.text: -------------------------------------------------------------------------------- 1 | \[test](not a link) 2 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/marked'); 2 | -------------------------------------------------------------------------------- /test/new/gfm_del.html: -------------------------------------------------------------------------------- 1 |hello hi world
[test](not a link)
2 | -------------------------------------------------------------------------------- /test/new/same_bullet.text: -------------------------------------------------------------------------------- 1 | * test 2 | + test 3 | - test 4 | -------------------------------------------------------------------------------- /test/tests/lazy_blockquotes.text: -------------------------------------------------------------------------------- 1 | > hi there 2 | bud 3 | -------------------------------------------------------------------------------- /test/tests/not_a_link.html: -------------------------------------------------------------------------------- 1 |[test](not a link)
2 | -------------------------------------------------------------------------------- /test/new/gfm_em.text: -------------------------------------------------------------------------------- 1 | These words should_not_be_emphasized. 2 | -------------------------------------------------------------------------------- /test/new/nested_code.text: -------------------------------------------------------------------------------- 1 | ````` hi ther `` ok ``` ````` 2 | -------------------------------------------------------------------------------- /test/new/nested_square_link.text: -------------------------------------------------------------------------------- 1 | [the `]` character](/url) 2 | -------------------------------------------------------------------------------- /test/new/ref_paren.text: -------------------------------------------------------------------------------- 1 | [hi] 2 | 3 | [hi]: /url (there) 4 | -------------------------------------------------------------------------------- /test/tests/gfm_del.html: -------------------------------------------------------------------------------- 1 |hello hi world
hi ther `` ok ```
These words should_not_be_emphasized.
2 | -------------------------------------------------------------------------------- /test/new/ref_paren.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/tests/autolink_lines.text: -------------------------------------------------------------------------------- 1 | hello world 2 |These words should_not_be_emphasized.
2 | -------------------------------------------------------------------------------- /test/tests/nested_code.html: -------------------------------------------------------------------------------- 1 |hi ther `` ok ```
Look at the
pretty line
breaks.
Look at the
pretty line
breaks.
2 |5 | -------------------------------------------------------------------------------- /test/new/same_bullet.html: -------------------------------------------------------------------------------- 1 |hi there 3 | bud
4 |
2 |5 | -------------------------------------------------------------------------------- /test/new/list_item_text.html: -------------------------------------------------------------------------------- 1 |hi there 3 | bud
4 |
item1
text
item1
text
hello world 2 | http://example.com 3 |
4 | -------------------------------------------------------------------------------- /test/tests/blockquote_list_item.text: -------------------------------------------------------------------------------- 1 | This fails in markdown.pl and upskirt: 2 | 3 | * hello 4 | > world 5 | -------------------------------------------------------------------------------- /test/tests/autolink_lines.html: -------------------------------------------------------------------------------- 1 |hello world 2 | http://example.com 3 |
4 | -------------------------------------------------------------------------------- /test/tests/tidyness.text: -------------------------------------------------------------------------------- 1 | > A list within a blockquote: 2 | > 3 | > * asterisk 1 4 | > * asterisk 2 5 | > * asterisk 3 6 | -------------------------------------------------------------------------------- /test/original/tidyness.text: -------------------------------------------------------------------------------- 1 | > A list within a blockquote: 2 | > 3 | > * asterisk 1 4 | > * asterisk 2 5 | > * asterisk 3 6 | -------------------------------------------------------------------------------- /test/new/nested_em.html: -------------------------------------------------------------------------------- 1 |test test test
2 | 3 |test test test
4 | -------------------------------------------------------------------------------- /test/new/gfm_links.html: -------------------------------------------------------------------------------- 1 |This should be a link: 2 | http://example.com/hello-world.
3 | -------------------------------------------------------------------------------- /test/tests/nested_em.html: -------------------------------------------------------------------------------- 1 |test test test
2 | 3 |test test test
4 | -------------------------------------------------------------------------------- /test/tests/gfm_links.html: -------------------------------------------------------------------------------- 1 |This should be a link: 2 | http://example.com/hello-world.
3 | -------------------------------------------------------------------------------- /test/new/hr_list_break.html: -------------------------------------------------------------------------------- 1 |you today?
11 | -------------------------------------------------------------------------------- /test/new/blockquote_list_item.html: -------------------------------------------------------------------------------- 1 |This fails in markdown.pl and upskirt:
2 | 3 |world
This fails in markdown.pl and upskirt:
2 | 3 |world
you today?
11 | -------------------------------------------------------------------------------- /test/browser/index.html: -------------------------------------------------------------------------------- 1 | 2 |testing...
4 | 5 | 6 | -------------------------------------------------------------------------------- /test/tests/strong_and_em_together.text: -------------------------------------------------------------------------------- 1 | ***This is strong and em.*** 2 | 3 | So is ***this*** word. 4 | 5 | ___This is strong and em.___ 6 | 7 | So is ___this___ word. 8 | -------------------------------------------------------------------------------- /test/original/strong_and_em_together.text: -------------------------------------------------------------------------------- 1 | ***This is strong and em.*** 2 | 3 | So is ***this*** word. 4 | 5 | ___This is strong and em.___ 6 | 7 | So is ___this___ word. 8 | -------------------------------------------------------------------------------- /test/tests/literal_quotes_in_titles.text: -------------------------------------------------------------------------------- 1 | Foo [bar][]. 2 | 3 | Foo [bar](/url/ "Title with "quotes" inside"). 4 | 5 | 6 | [bar]: /url/ "Title with "quotes" inside" 7 | 8 | -------------------------------------------------------------------------------- /test/original/literal_quotes_in_titles.text: -------------------------------------------------------------------------------- 1 | Foo [bar][]. 2 | 3 | Foo [bar](/url/ "Title with "quotes" inside"). 4 | 5 | 6 | [bar]: /url/ "Title with "quotes" inside" 7 | 8 | -------------------------------------------------------------------------------- /test/new/text.smartypants.text: -------------------------------------------------------------------------------- 1 | Hello world 'how' "are" you -- today... 2 | 3 | "It's a more 'challenging' smartypants test..." 4 | 5 | 'And,' as a bonus -- "one 6 | multiline" test! 7 | -------------------------------------------------------------------------------- /test/original/nested_blockquotes.html: -------------------------------------------------------------------------------- 1 |2 |10 | -------------------------------------------------------------------------------- /test/tests/nested_blockquotes.html: -------------------------------------------------------------------------------- 1 |foo
3 | 4 |5 |7 | 8 |bar
6 |foo
9 |
2 |10 | -------------------------------------------------------------------------------- /test/original/tidyness.html: -------------------------------------------------------------------------------- 1 |foo
3 | 4 |5 |7 | 8 |bar
6 |foo
9 |
2 |9 | -------------------------------------------------------------------------------- /test/tests/text.smartypants.text: -------------------------------------------------------------------------------- 1 | Hello world 'how' "are" you -- today... 2 | 3 | "It's a more 'challenging' smartypants test..." 4 | 5 | 'And,' as a bonus -- "one 6 | multiline" test! 7 | -------------------------------------------------------------------------------- /test/tests/tidyness.html: -------------------------------------------------------------------------------- 1 |A list within a blockquote:
3 |4 |
8 |- asterisk 1
5 |- asterisk 2
6 |- asterisk 3
7 |
2 |9 | -------------------------------------------------------------------------------- /test/new/text.smartypants.html: -------------------------------------------------------------------------------- 1 |A list within a blockquote:
3 |4 |
8 |- asterisk 1
5 |- asterisk 2
6 |- asterisk 3
7 |
Hello world ‘how’ “are” you — today…
2 | 3 |“It’s a more ‘challenging’ smartypants test…”
4 | 5 |‘And,’ as a bonus — “one 6 | multiline” test!
7 | -------------------------------------------------------------------------------- /test/tests/text.smartypants.html: -------------------------------------------------------------------------------- 1 |Hello world ‘how’ “are” you — today…
2 | 3 |“It’s a more ‘challenging’ smartypants test…”
4 | 5 |‘And,’ as a bonus — “one 6 | multiline” test!
7 | -------------------------------------------------------------------------------- /test/original/literal_quotes_in_titles.html: -------------------------------------------------------------------------------- 1 |Foo bar.
2 | 3 |Foo bar.
4 | -------------------------------------------------------------------------------- /test/tests/code_spans.text: -------------------------------------------------------------------------------- 1 | `Foo bar.
2 | 3 |Foo bar.
4 | -------------------------------------------------------------------------------- /test/original/code_spans.text: -------------------------------------------------------------------------------- 1 | `Already linked: http://example.com/.
2 | 3 | Already linked: [http://example.com/](http://example.com/). 4 | 5 | Already linked: **http://example.com/**. 6 | -------------------------------------------------------------------------------- /test/tests/double_link.text: -------------------------------------------------------------------------------- 1 |Already linked: http://example.com/.
2 | 3 | Already linked: [http://example.com/](http://example.com/). 4 | 5 | Already linked: **http://example.com/**. 6 | -------------------------------------------------------------------------------- /test/tests/inline_html_advanced.text: -------------------------------------------------------------------------------- 1 | Simple block on one line: 2 | 3 |<test a=" content of attribute ">
Fix for backticks within HTML tag: like this
4 | 5 |Here's how you put `backticks` in a code span.
Simple block on one line:
2 | 3 |And nested without indentation:
6 | 7 |Simple block on one line:
2 | 3 |And nested without indentation:
6 | 7 |This is strong and em.
2 | 3 |So is this word.
4 | 5 |This is strong and em.
6 | 7 |So is this word.
8 | -------------------------------------------------------------------------------- /test/original/strong_and_em_together.html: -------------------------------------------------------------------------------- 1 |This is strong and em.
2 | 3 |So is this word.
4 | 5 |This is strong and em.
6 | 7 |So is this word.
8 | -------------------------------------------------------------------------------- /test/tests/code_spans.html: -------------------------------------------------------------------------------- 1 |<test a=" content of attribute ">
Fix for backticks within HTML tag: like this
4 | 5 |Here's how you put `backticks` in a code span.
Paragraph one.
2 | 3 | 4 | 5 | 8 | 9 |Paragraph two.
10 | 11 | 12 | 13 |The end.
14 | -------------------------------------------------------------------------------- /test/tests/inline_html_comments.html: -------------------------------------------------------------------------------- 1 |Paragraph one.
2 | 3 | 4 | 5 | 8 | 9 |Paragraph two.
10 | 11 | 12 | 13 |The end.
14 | -------------------------------------------------------------------------------- /test/new/double_link.html: -------------------------------------------------------------------------------- 1 |Already linked: http://example.com/.
2 | 3 |Already linked: http://example.com/.
4 | 5 |Already linked: http://example.com/.
6 | -------------------------------------------------------------------------------- /test/tests/code_blocks.text: -------------------------------------------------------------------------------- 1 | code block on the first line 2 | 3 | Regular text. 4 | 5 | code block indented by spaces 6 | 7 | Regular text. 8 | 9 | the lines in this block 10 | all contain trailing spaces 11 | 12 | Regular Text. 13 | 14 | code block on the last line 15 | -------------------------------------------------------------------------------- /test/tests/hard_wrapped_paragraphs_with_list_like_lines.nogfm.text: -------------------------------------------------------------------------------- 1 | In Markdown 1.0.0 and earlier. Version 2 | 8. This line turns into a list item. 3 | Because a hard-wrapped line in the 4 | middle of a paragraph looked like a 5 | list item. 6 | 7 | Here's one with a bullet. 8 | * criminey. 9 | -------------------------------------------------------------------------------- /test/original/code_blocks.text: -------------------------------------------------------------------------------- 1 | code block on the first line 2 | 3 | Regular text. 4 | 5 | code block indented by spaces 6 | 7 | Regular text. 8 | 9 | the lines in this block 10 | all contain trailing spaces 11 | 12 | Regular Text. 13 | 14 | code block on the last line 15 | -------------------------------------------------------------------------------- /test/tests/double_link.html: -------------------------------------------------------------------------------- 1 |Already linked: http://example.com/.
2 | 3 |Already linked: http://example.com/.
4 | 5 |Already linked: http://example.com/.
6 | -------------------------------------------------------------------------------- /test/original/hard_wrapped_paragraphs_with_list_like_lines.html: -------------------------------------------------------------------------------- 1 |In Markdown 1.0.0 and earlier. Version 2 | 8. This line turns into a list item. 3 | Because a hard-wrapped line in the 4 | middle of a paragraph looked like a 5 | list item.
6 | 7 |Here's one with a bullet. 8 | * criminey.
9 | -------------------------------------------------------------------------------- /test/original/blockquotes_with_code_blocks.html: -------------------------------------------------------------------------------- 1 |2 |16 | -------------------------------------------------------------------------------- /test/tests/hard_wrapped_paragraphs_with_list_like_lines.nogfm.html: -------------------------------------------------------------------------------- 1 |Example:
3 | 4 |8 | 9 |sub status { 5 | print "working"; 6 | } 7 |Or:
10 | 11 |15 |sub status { 12 | return "working"; 13 | } 14 |
In Markdown 1.0.0 and earlier. Version 2 | 8. This line turns into a list item. 3 | Because a hard-wrapped line in the 4 | middle of a paragraph looked like a 5 | list item.
6 | 7 |Here's one with a bullet. 8 | * criminey.
9 | -------------------------------------------------------------------------------- /component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "marked", 3 | "version": "0.3.2", 4 | "repo": "chjj/marked", 5 | "description": "A markdown parser built for speed", 6 | "keywords": ["markdown", "markup", "html"], 7 | "scripts": ["lib/marked.js"], 8 | "main": "lib/marked.js", 9 | "license": "MIT" 10 | } 11 | -------------------------------------------------------------------------------- /test/new/gfm_code.text: -------------------------------------------------------------------------------- 1 | ``` js 2 | var a = 'hello'; 3 | console.log(a + ' world'); 4 | ``` 5 | 6 | ~~~bash 7 | echo "hello, ${WORLD}" 8 | ~~~ 9 | 10 | ```````longfence 11 | Q: What do you call a tall person who sells stolen goods? 12 | ``````` 13 | 14 | ~~~~~~~~~~ ManyTildes 15 | A longfence! 16 | ~~~~~~~~~~ 17 | -------------------------------------------------------------------------------- /test/tests/blockquotes_with_code_blocks.html: -------------------------------------------------------------------------------- 1 |2 |16 | -------------------------------------------------------------------------------- /test/tests/gfm_code.text: -------------------------------------------------------------------------------- 1 | ``` js 2 | var a = 'hello'; 3 | console.log(a + ' world'); 4 | ``` 5 | 6 | ~~~bash 7 | echo "hello, ${WORLD}" 8 | ~~~ 9 | 10 | ```````longfence 11 | Q: What do you call a tall person who sells stolen goods? 12 | ``````` 13 | 14 | ~~~~~~~~~~ ManyTildes 15 | A longfence! 16 | ~~~~~~~~~~ 17 | -------------------------------------------------------------------------------- /test/tests/links_shortcut_references.html: -------------------------------------------------------------------------------- 1 |Example:
3 | 4 |8 | 9 |sub status { 5 | print "working"; 6 | } 7 |Or:
10 | 11 |15 |sub status { 12 | return "working"; 13 | } 14 |
This is the simple case.
2 | 3 |This one has a line 4 | break.
5 | 6 |This one has a line 7 | break with a line-ending space.
8 | 9 | 10 | -------------------------------------------------------------------------------- /test/original/links_shortcut_references.html: -------------------------------------------------------------------------------- 1 |This is the simple case.
2 | 3 |This one has a line 4 | break.
5 | 6 |This one has a line 7 | break with a line-ending space.
8 | 9 | 10 | -------------------------------------------------------------------------------- /test/tests/auto_links.text: -------------------------------------------------------------------------------- 1 | Link:var a = 'hello';
2 | console.log(a + ' world');
3 | echo "hello, ${WORLD}"
4 | Q: What do you call a tall person who sells stolen goods?
5 | A longfence!
6 |
--------------------------------------------------------------------------------
/test/original/links_shortcut_references.text:
--------------------------------------------------------------------------------
1 | This is the [simple case].
2 |
3 | [simple case]: /simple
4 |
5 |
6 |
7 | This one has a [line
8 | break].
9 |
10 | This one has a [line
11 | break] with a line-ending space.
12 |
13 | [line break]: /foo
14 |
15 |
16 | [this] [that] and the [other]
17 |
18 | [this]: /this
19 | [that]: /that
20 | [other]: /other
21 |
--------------------------------------------------------------------------------
/test/tests/gfm_code.html:
--------------------------------------------------------------------------------
1 | var a = 'hello';
2 | console.log(a + ' world');
3 | echo "hello, ${WORLD}"
4 | Q: What do you call a tall person who sells stolen goods?
5 | A longfence!
6 |
--------------------------------------------------------------------------------
/test/new/def_blocks.html:
--------------------------------------------------------------------------------
1 | 2 |5 | 6 |hello 3 | [1]: hello
4 |
9 |11 | 12 | 13 |hello
10 |
25 |29 | -------------------------------------------------------------------------------- /test/tests/def_blocks.html: -------------------------------------------------------------------------------- 1 |foo 26 | bar 27 | bar
28 |
2 |5 | 6 |hello 3 | [1]: hello
4 |
9 |11 | 12 | 13 |hello
10 |
25 |29 | -------------------------------------------------------------------------------- /test/original/code_blocks.html: -------------------------------------------------------------------------------- 1 |foo 26 | bar 27 | bar
28 |
code block on the first line
2 |
3 |
4 | Regular text.
5 | 6 |code block indented by spaces
7 |
8 |
9 | Regular text.
10 | 11 |the lines in this block
12 | all contain trailing spaces
13 |
14 |
15 | Regular Text.
16 | 17 |code block on the last line
18 |
19 |
--------------------------------------------------------------------------------
/test/tests/code_blocks.html:
--------------------------------------------------------------------------------
1 | code block on the first line
2 |
3 |
4 | Regular text.
5 | 6 |code block indented by spaces
7 |
8 |
9 | Regular text.
10 | 11 |the lines in this block
12 | all contain trailing spaces
13 |
14 |
15 | Regular Text.
16 | 17 |code block on the last line
18 |
19 |
--------------------------------------------------------------------------------
/test/tests/links_inline_style.text:
--------------------------------------------------------------------------------
1 | Just a [URL](/url/).
2 |
3 | [URL and title](/url/ "title").
4 |
5 | [URL and title](/url/ "title preceded by two spaces").
6 |
7 | [URL and title](/url/ "title preceded by a tab").
8 |
9 | [URL and title](/url/ "title has spaces afterward" ).
10 |
11 | [URL and title]( /url/has space ).
12 |
13 | [URL and title]( /url/has space/ "url has space and title").
14 |
15 | [Empty]().
16 |
--------------------------------------------------------------------------------
/test/tests/tabs.text:
--------------------------------------------------------------------------------
1 | + this is a list item
2 | indented with tabs
3 |
4 | + this is a list item
5 | indented with spaces
6 |
7 | Code:
8 |
9 | this code block is indented by one tab
10 |
11 | And:
12 |
13 | this code block is indented by two tabs
14 |
15 | And:
16 |
17 | + this is an example list item
18 | indented with tabs
19 |
20 | + this is an example list item
21 | indented with spaces
22 |
--------------------------------------------------------------------------------
/test/original/links_inline_style.text:
--------------------------------------------------------------------------------
1 | Just a [URL](/url/).
2 |
3 | [URL and title](/url/ "title").
4 |
5 | [URL and title](/url/ "title preceded by two spaces").
6 |
7 | [URL and title](/url/ "title preceded by a tab").
8 |
9 | [URL and title](/url/ "title has spaces afterward" ).
10 |
11 | [URL and title]( /url/has space ).
12 |
13 | [URL and title]( /url/has space/ "url has space and title").
14 |
15 | [Empty]().
16 |
--------------------------------------------------------------------------------
/test/original/tabs.text:
--------------------------------------------------------------------------------
1 | + this is a list item
2 | indented with tabs
3 |
4 | + this is a list item
5 | indented with spaces
6 |
7 | Code:
8 |
9 | this code block is indented by one tab
10 |
11 | And:
12 |
13 | this code block is indented by two tabs
14 |
15 | And:
16 |
17 | + this is an example list item
18 | indented with tabs
19 |
20 | + this is an example list item
21 | indented with spaces
22 |
--------------------------------------------------------------------------------
/test/new/tricky_list.html:
--------------------------------------------------------------------------------
1 | hello world
2 | 3 |hello world
8 | 9 |hello world
14 | 15 |hello world
20 | 21 |hello world
2 | 3 |hello world
8 | 9 |hello world
14 | 15 |hello world
20 | 21 |this is a list item 3 | indented with tabs
this is a list item 5 | indented with spaces
Code:
9 | 10 |this code block is indented by one tab
11 |
12 |
13 | And:
14 | 15 | this code block is indented by two tabs
16 |
17 |
18 | And:
19 | 20 |+ this is an example list item
21 | indented with tabs
22 |
23 | + this is an example list item
24 | indented with spaces
25 |
26 |
--------------------------------------------------------------------------------
/test/tests/loose_lists.text:
--------------------------------------------------------------------------------
1 | * hello
2 | world
3 |
4 | how
5 | are
6 | * you
7 |
8 |
9 |
10 | better behavior:
11 |
12 | * hello
13 | * world
14 | how
15 |
16 | are
17 | you
18 |
19 | * today
20 | * hi
21 |
22 |
23 |
24 | * hello
25 |
26 | * world
27 | * hi
28 |
29 |
30 |
31 | * hello
32 | * world
33 |
34 | * hi
35 |
36 |
37 |
38 | * hello
39 | * world
40 |
41 | how
42 | * hi
43 |
44 |
45 |
46 | * hello
47 | * world
48 | * how
49 |
50 | are
51 |
52 |
53 |
54 | * hello
55 | * world
56 |
57 | * how
58 |
59 | are
60 |
--------------------------------------------------------------------------------
/test/tests/tabs.html:
--------------------------------------------------------------------------------
1 | this is a list item 3 | indented with tabs
this is a list item 5 | indented with spaces
Code:
9 | 10 |this code block is indented by one tab
11 |
12 |
13 | And:
14 | 15 | this code block is indented by two tabs
16 |
17 |
18 | And:
19 | 20 |+ this is an example list item
21 | indented with tabs
22 |
23 | + this is an example list item
24 | indented with spaces
25 |
26 |
--------------------------------------------------------------------------------
/test/tests/toplevel_paragraphs.gfm.text:
--------------------------------------------------------------------------------
1 | hello world
2 | how are you
3 | how are you
4 |
5 | hello world
6 | ```
7 | how are you
8 | ```
9 |
10 | hello world
11 | * * *
12 |
13 | hello world
14 | # how are you
15 |
16 | hello world
17 | how are you
18 | ===========
19 |
20 | hello world
21 | > how are you
22 |
23 | hello world
24 | * how are you
25 |
26 | hello world
27 | Just a URL.
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/original/links_inline_style.html: -------------------------------------------------------------------------------- 1 |Just a URL.
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/new/gfm_tables.text: -------------------------------------------------------------------------------- 1 | | Heading 1 | Heading 2 2 | | --------- | --------- 3 | | Cell 1 | Cell 2 4 | | Cell 3 | Cell 4 5 | 6 | | Header 1 | Header 2 | Header 3 | Header 4 | 7 | | :------: | -------: | :------- | -------- | 8 | | Cell 1 | Cell 2 | Cell 3 | Cell 4 | 9 | | Cell 5 | Cell 6 | Cell 7 | Cell 8 | 10 | 11 | Test code 12 | 13 | Header 1 | Header 2 14 | -------- | -------- 15 | Cell 1 | Cell 2 16 | Cell 3 | Cell 4 17 | 18 | Header 1|Header 2|Header 3|Header 4 19 | :-------|:------:|-------:|-------- 20 | Cell 1 |Cell 2 |Cell 3 |Cell 4 21 | *Cell 5*|Cell 6 |Cell 7 |Cell 8 22 | -------------------------------------------------------------------------------- /test/original/amps_and_angles_encoding.html: -------------------------------------------------------------------------------- 1 |AT&T has an ampersand in their name.
2 | 3 |AT&T is another way to write it.
4 | 5 |This & that.
6 | 7 |4 < 5.
8 | 9 |6 > 5.
10 | 11 |Here's a link with an ampersand in the URL.
12 | 13 |Here's a link with an amersand in the link text: AT&T.
14 | 15 |Here's an inline link.
16 | 17 |Here's an inline link.
18 | -------------------------------------------------------------------------------- /test/tests/horizontal_rules.text: -------------------------------------------------------------------------------- 1 | Dashes: 2 | 3 | --- 4 | 5 | --- 6 | 7 | --- 8 | 9 | --- 10 | 11 | --- 12 | 13 | - - - 14 | 15 | - - - 16 | 17 | - - - 18 | 19 | - - - 20 | 21 | - - - 22 | 23 | 24 | Asterisks: 25 | 26 | *** 27 | 28 | *** 29 | 30 | *** 31 | 32 | *** 33 | 34 | *** 35 | 36 | * * * 37 | 38 | * * * 39 | 40 | * * * 41 | 42 | * * * 43 | 44 | * * * 45 | 46 | 47 | Underscores: 48 | 49 | ___ 50 | 51 | ___ 52 | 53 | ___ 54 | 55 | ___ 56 | 57 | ___ 58 | 59 | _ _ _ 60 | 61 | _ _ _ 62 | 63 | _ _ _ 64 | 65 | _ _ _ 66 | 67 | _ _ _ 68 | -------------------------------------------------------------------------------- /test/original/horizontal_rules.text: -------------------------------------------------------------------------------- 1 | Dashes: 2 | 3 | --- 4 | 5 | --- 6 | 7 | --- 8 | 9 | --- 10 | 11 | --- 12 | 13 | - - - 14 | 15 | - - - 16 | 17 | - - - 18 | 19 | - - - 20 | 21 | - - - 22 | 23 | 24 | Asterisks: 25 | 26 | *** 27 | 28 | *** 29 | 30 | *** 31 | 32 | *** 33 | 34 | *** 35 | 36 | * * * 37 | 38 | * * * 39 | 40 | * * * 41 | 42 | * * * 43 | 44 | * * * 45 | 46 | 47 | Underscores: 48 | 49 | ___ 50 | 51 | ___ 52 | 53 | ___ 54 | 55 | ___ 56 | 57 | ___ 58 | 59 | _ _ _ 60 | 61 | _ _ _ 62 | 63 | _ _ _ 64 | 65 | _ _ _ 66 | 67 | _ _ _ 68 | -------------------------------------------------------------------------------- /test/tests/gfm_tables.text: -------------------------------------------------------------------------------- 1 | | Heading 1 | Heading 2 2 | | --------- | --------- 3 | | Cell 1 | Cell 2 4 | | Cell 3 | Cell 4 5 | 6 | | Header 1 | Header 2 | Header 3 | Header 4 | 7 | | :------: | -------: | :------- | -------- | 8 | | Cell 1 | Cell 2 | Cell 3 | Cell 4 | 9 | | Cell 5 | Cell 6 | Cell 7 | Cell 8 | 10 | 11 | Test code 12 | 13 | Header 1 | Header 2 14 | -------- | -------- 15 | Cell 1 | Cell 2 16 | Cell 3 | Cell 4 17 | 18 | Header 1|Header 2|Header 3|Header 4 19 | :-------|:------:|-------:|-------- 20 | Cell 1 |Cell 2 |Cell 3 |Cell 4 21 | *Cell 5*|Cell 6 |Cell 7 |Cell 8 22 | -------------------------------------------------------------------------------- /test/tests/amps_and_angles_encoding.html: -------------------------------------------------------------------------------- 1 |AT&T has an ampersand in their name.
2 | 3 |AT&T is another way to write it.
4 | 5 |This & that.
6 | 7 |4 < 5.
8 | 9 |6 > 5.
10 | 11 |Here's a link with an ampersand in the URL.
12 | 13 |Here's a link with an amersand in the link text: AT&T.
14 | 15 |Here's an inline link.
16 | 17 |Here's an inline link.
18 | -------------------------------------------------------------------------------- /test/tests/auto_links.html: -------------------------------------------------------------------------------- 1 |Link: http://example.com/.
2 | 3 |With an ampersand: http://example.com/?foo=1&bar=2
4 | 5 |12 |14 | 15 |Blockquoted: http://example.com/
13 |
Auto-links should not occur here: <http://example.com/>
or here: <http://example.com/>
18 |
19 |
--------------------------------------------------------------------------------
/test/original/auto_links.html:
--------------------------------------------------------------------------------
1 | Link: http://example.com/.
2 | 3 |With an ampersand: http://example.com/?foo=1&bar=2
4 | 5 |12 |14 | 15 |Blockquoted: http://example.com/
13 |
Auto-links should not occur here: <http://example.com/>
or here: <http://example.com/>
18 |
19 |
--------------------------------------------------------------------------------
/test/new/toplevel_paragraphs.gfm.html:
--------------------------------------------------------------------------------
1 | hello world 2 | how are you 3 | how are you
4 | 5 |hello world
6 |how are you
7 |
8 | hello world
9 |hello world
12 |hello world
15 |hello world
18 |19 | 20 |how are you
hello world
21 |hello world
24 |hello world 27 | how are you
28 | 29 |hello world 30 |
31 | 32 |hello
35 | -------------------------------------------------------------------------------- /test/tests/toplevel_paragraphs.gfm.html: -------------------------------------------------------------------------------- 1 |hello world 2 | how are you 3 | how are you
4 | 5 |hello world
6 |how are you
7 |
8 | hello world
9 |hello world
12 |hello world
15 |hello world
18 |19 | 20 |how are you
hello world
21 |hello world
24 |hello world 27 | how are you
28 | 29 |hello world 30 |
31 | 32 |hello
35 | -------------------------------------------------------------------------------- /test/tests/horizontal_rules.html: -------------------------------------------------------------------------------- 1 |Dashes:
2 | 3 |---
12 |
13 |
14 | - - -
23 |
24 |
25 | Asterisks:
26 | 27 |***
36 |
37 |
38 | * * *
47 |
48 |
49 | Underscores:
50 | 51 |___
60 |
61 |
62 | _ _ _
71 |
72 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "marked",
3 | "description": "A markdown parser built for speed",
4 | "author": "Christopher Jeffrey",
5 | "version": "0.3.2",
6 | "main": "./lib/marked.js",
7 | "bin": "./bin/marked",
8 | "man": "./man/marked.1",
9 | "preferGlobal": true,
10 | "repository": "git://github.com/chjj/marked.git",
11 | "homepage": "https://github.com/chjj/marked",
12 | "bugs": { "url": "http://github.com/chjj/marked/issues" },
13 | "license": "MIT",
14 | "keywords": ["markdown", "markup", "html"],
15 | "tags": ["markdown", "markup", "html"],
16 | "devDependencies": {
17 | "markdown": "*",
18 | "showdown": "*",
19 | "robotskirt": "*"
20 | },
21 | "scripts": { "test": "node test", "bench": "node test --bench" }
22 | }
23 |
--------------------------------------------------------------------------------
/test/original/horizontal_rules.html:
--------------------------------------------------------------------------------
1 | Dashes:
2 | 3 |---
12 |
13 |
14 | - - -
23 |
24 |
25 | Asterisks:
26 | 27 |***
36 |
37 |
38 | * * *
47 |
48 |
49 | Underscores:
50 | 51 |___
60 |
61 |
62 | _ _ _
71 |
72 |
--------------------------------------------------------------------------------
/test/new/gfm_code_hr_list.text:
--------------------------------------------------------------------------------
1 | ## foo
2 |
3 | 1. bar:
4 |
5 | > - one
6 | - two
7 | - three
8 | - four
9 | - five
10 |
11 | 1. foo:
12 |
13 | ```
14 | line 1
15 | line 2
16 | ```
17 |
18 | 1. foo:
19 |
20 | 1. foo `bar` bar:
21 |
22 | ``` erb
23 | some code here
24 | ```
25 |
26 | 2. foo `bar` bar:
27 |
28 | ``` erb
29 | foo
30 | ---
31 | bar
32 | ---
33 | foo
34 | bar
35 | ```
36 |
37 | 3. foo `bar` bar:
38 |
39 | ``` html
40 | ---
41 | foo
42 | foo
43 | ---
44 | bar
45 | ```
46 |
47 | 4. foo `bar` bar:
48 |
49 | foo
50 | ---
51 | bar
52 |
53 | 5. foo
54 |
--------------------------------------------------------------------------------
/test/tests/gfm_code_hr_list.text:
--------------------------------------------------------------------------------
1 | ## foo
2 |
3 | 1. bar:
4 |
5 | > - one
6 | - two
7 | - three
8 | - four
9 | - five
10 |
11 | 1. foo:
12 |
13 | ```
14 | line 1
15 | line 2
16 | ```
17 |
18 | 1. foo:
19 |
20 | 1. foo `bar` bar:
21 |
22 | ``` erb
23 | some code here
24 | ```
25 |
26 | 2. foo `bar` bar:
27 |
28 | ``` erb
29 | foo
30 | ---
31 | bar
32 | ---
33 | foo
34 | bar
35 | ```
36 |
37 | 3. foo `bar` bar:
38 |
39 | ``` html
40 | ---
41 | foo
42 | foo
43 | ---
44 | bar
45 | ```
46 |
47 | 4. foo `bar` bar:
48 |
49 | foo
50 | ---
51 | bar
52 |
53 | 5. foo
54 |
--------------------------------------------------------------------------------
/test/new/loose_lists.html:
--------------------------------------------------------------------------------
1 | hello 3 | world
4 | 5 |how 6 | are
better behavior:
13 | 14 |hello
world 15 | how
are 16 | you
today
hello
world
world
hi
world
39 | 40 |how
how
50 | 51 |are
world
how
60 | 61 |are
hello 3 | world
4 | 5 |how 6 | are
better behavior:
13 | 14 |hello
world 15 | how
are 16 | you
today
hello
world
world
hi
world
39 | 40 |how
how
50 | 51 |are
world
how
60 | 61 |are
bar:
4 |5 |17 |6 |
16 |- one
15 |7 |
14 |- two
13 |8 |
12 |- three
9 |- four
10 |- five
11 |
foo:
19 | line 1
20 | line 2
21 | foo:
23 |foo bar bar:
some code here
26 |
27 | foo bar bar:
foo
30 | ---
31 | bar
32 | ---
33 | foo
34 | bar
35 | foo bar bar:
---
38 | foo
39 | foo
40 | ---
41 | bar
42 | foo bar bar:
foo
45 | ---
46 | bar
47 | foo
49 |bar:
4 |5 |17 |6 |
16 |- one
15 |7 |
14 |- two
13 |8 |
12 |- three
9 |- four
10 |- five
11 |
foo:
19 | line 1
20 | line 2
21 | foo:
23 |foo bar bar:
some code here
26 |
27 | foo bar bar:
foo
30 | ---
31 | bar
32 | ---
33 | foo
34 | bar
35 | foo bar bar:
---
38 | foo
39 | foo
40 | ---
41 | bar
42 | foo bar bar:
foo
45 | ---
46 | bar
47 | foo
49 |Here's a simple block:
2 | 3 |This should be a code block, though:
8 | 9 |<div>
10 | foo
11 | </div>
12 |
13 |
14 | As should this:
15 | 16 |<div>foo</div>
17 |
18 |
19 | Now, nested:
20 | 21 |This should just be an HTML comment:
30 | 31 | 32 | 33 |Multiline:
34 | 35 | 39 | 40 |Code block:
41 | 42 |<!-- Comment -->
43 |
44 |
45 | Just plain comment, with trailing spaces on the line:
46 | 47 | 48 | 49 |Code:
50 | 51 |<hr />
52 |
53 |
54 | Hr's:
55 | 56 |Here's a simple block:
2 | 3 |This should be a code block, though:
8 | 9 |<div>
10 | foo
11 | </div>
12 |
13 |
14 | As should this:
15 | 16 |<div>foo</div>
17 |
18 |
19 | Now, nested:
20 | 21 |This should just be an HTML comment:
30 | 31 | 32 | 33 |Multiline:
34 | 35 | 39 | 40 |Code block:
41 | 42 |<!-- Comment -->
43 |
44 |
45 | Just plain comment, with trailing spaces on the line:
46 | 47 | 48 | 49 |Code:
50 | 51 |<hr>
52 |
53 |
54 | Hr's:
55 | 56 |Just a note, I've found that I can't test my markdown parser vs others. For example, both markdown.js and showdown code blocks in lists wrong. They're also completely inconsistent with regards to paragraphs in list items.
A link. Not anymore.
List Item 1
List Item 2
Code goes here.
3 | Lots of it...List Item 3 The final item.
List Item 4 The real final item.
Paragraph.
- bq Item 1
- bq Item 2
- New bq Item 1
- New bq Item 2 Text here
Another blockquote! I really need to get more creative with mockup text.. markdown.js breaks here again
Hello world. Here is a link. And an image .
Code goes here.
4 | Lots of it...
5 |
--------------------------------------------------------------------------------
/test/tests/main.html:
--------------------------------------------------------------------------------
1 | Just a note, I've found that I can't test my markdown parser vs others. For example, both markdown.js and showdown code blocks in lists wrong. They're also completely inconsistent with regards to paragraphs in list items.
A link. Not anymore.
List Item 1
List Item 2
Code goes here.
3 | Lots of it...List Item 3 The final item.
List Item 4 The real final item.
Paragraph.
- bq Item 1
- bq Item 2
- New bq Item 1
- New bq Item 2 Text here
Another blockquote! I really need to get more creative with mockup text.. markdown.js breaks here again
Hello world. Here is a link. And an image .
Code goes here.
4 | Lots of it...
5 |
--------------------------------------------------------------------------------
/test/original/links_reference_style.html:
--------------------------------------------------------------------------------
1 | Foo bar.
2 | 3 |Foo bar.
4 | 5 |Foo bar.
6 | 7 |With embedded [brackets].
8 | 9 |Indented once.
10 | 11 |Indented twice.
12 | 13 |Indented thrice.
14 | 15 |Indented [four][] times.
16 | 17 |[four]: /url
18 |
19 |
20 | this should work
23 | 24 |So should this.
25 | 26 |And this.
27 | 28 |And this.
29 | 30 |And this.
31 | 32 |But not [that] [].
33 | 34 |Nor [that][].
35 | 36 |Nor [that].
37 | 38 |[Something in brackets like this should work]
39 | 40 |[Same with this.]
41 | 42 |In this case, this points to something else.
43 | 44 |Backslashing should suppress [this] and [this].
45 | 46 |Here's one where the link 49 | breaks across lines.
50 | 51 |Here's another where the link 52 | breaks across lines, but with a line-ending space.
53 | -------------------------------------------------------------------------------- /test/tests/links_reference_style.html: -------------------------------------------------------------------------------- 1 |Foo bar.
2 | 3 |Foo bar.
4 | 5 |Foo bar.
6 | 7 |With embedded [brackets].
8 | 9 |Indented once.
10 | 11 |Indented twice.
12 | 13 |Indented thrice.
14 | 15 |Indented [four][] times.
16 | 17 |[four]: /url
18 |
19 |
20 | this should work
23 | 24 |So should this.
25 | 26 |And this.
27 | 28 |And this.
29 | 30 |And this.
31 | 32 |But not [that] [].
33 | 34 |Nor [that][].
35 | 36 |Nor [that].
37 | 38 |[Something in brackets like this should work]
39 | 40 |[Same with this.]
41 | 42 |In this case, this points to something else.
43 | 44 |Backslashing should suppress [this] and [this].
45 | 46 |Here's one where the link 49 | breaks across lines.
50 | 51 |Here's another where the link 52 | breaks across lines, but with a line-ending space.
53 | -------------------------------------------------------------------------------- /test/browser/test.js: -------------------------------------------------------------------------------- 1 | ;(function() { 2 | 3 | var console = {} 4 | , files = __TESTS__; 5 | 6 | console.log = function(text) { 7 | var args = Array.prototype.slice.call(arguments, 1) 8 | , i = 0; 9 | 10 | text = text.replace(/%\w/g, function() { 11 | return args[i++] || ''; 12 | }); 13 | 14 | if (window.console) window.console.log(text); 15 | document.body.innerHTML += '' + escape(text) + ''; 16 | }; 17 | 18 | if (!Object.keys) { 19 | Object.keys = function(obj) { 20 | var out = [] 21 | , key; 22 | 23 | for (key in obj) { 24 | if (Object.prototype.hasOwnProperty.call(obj, key)) { 25 | out.push(key); 26 | } 27 | } 28 | 29 | return out; 30 | }; 31 | } 32 | 33 | if (!Array.prototype.forEach) { 34 | Array.prototype.forEach = function(callback, context) { 35 | for (var i = 0; i < this.length; i++) { 36 | callback.call(context || null, this[i], i, obj); 37 | } 38 | }; 39 | } 40 | 41 | if (!String.prototype.trim) { 42 | String.prototype.trim = function() { 43 | return this.replace(/^\s+|\s+$/g, ''); 44 | }; 45 | } 46 | 47 | function load() { 48 | return files; 49 | } 50 | 51 | function escape(html, encode) { 52 | return html 53 | .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') 54 | .replace(//g, '>') 56 | .replace(/"/g, '"') 57 | .replace(/'/g, '''); 58 | } 59 | 60 | (__MAIN__)(); 61 | 62 | }).call(this); 63 | -------------------------------------------------------------------------------- /test/new/gfm_tables.html: -------------------------------------------------------------------------------- 1 |
| Heading 1 | Heading 2 |
|---|---|
| Cell 1 | Cell 2 |
| Cell 3 | Cell 4 |
| Header 1 | Header 2 | Header 3 | Header 4 |
|---|---|---|---|
| Cell 1 | Cell 2 | Cell 3 | Cell 4 |
| Cell 5 | Cell 6 | Cell 7 | Cell 8 |
Test code
20 | | Header 1 | Header 2 |
|---|---|
| Cell 1 | Cell 2 |
| Cell 3 | Cell 4 |
| Header 1 | Header 2 | Header 3 | Header 4 |
|---|---|---|---|
| Cell 1 | Cell 2 | Cell 3 | Cell 4 |
| Cell 5 | Cell 6 | Cell 7 | Cell 8 |
| Heading 1 | Heading 2 |
|---|---|
| Cell 1 | Cell 2 |
| Cell 3 | Cell 4 |
| Header 1 | Header 2 | Header 3 | Header 4 |
|---|---|---|---|
| Cell 1 | Cell 2 | Cell 3 | Cell 4 |
| Cell 5 | Cell 6 | Cell 7 | Cell 8 |
Test code
20 | | Header 1 | Header 2 |
|---|---|
| Cell 1 | Cell 2 |
| Cell 3 | Cell 4 |
| Header 1 | Header 2 | Header 3 | Header 4 |
|---|---|---|---|
| Cell 1 | Cell 2 | Cell 3 | Cell 4 |
| Cell 5 | Cell 6 | Cell 7 | Cell 8 |
These should all get escaped:
2 | 3 |Backslash: \
4 | 5 |Backtick: `
6 | 7 |Asterisk: *
8 | 9 |Underscore: _
10 | 11 |Left brace: {
12 | 13 |Right brace: }
14 | 15 |Left bracket: [
16 | 17 |Right bracket: ]
18 | 19 |Left paren: (
20 | 21 |Right paren: )
22 | 23 |Greater-than: >
24 | 25 |Hash: #
26 | 27 |Period: .
28 | 29 |Bang: !
30 | 31 |Plus: +
32 | 33 |Minus: -
34 | 35 |These should not, because they occur within a code block:
36 | 37 |Backslash: \\
38 |
39 | Backtick: \`
40 |
41 | Asterisk: \*
42 |
43 | Underscore: \_
44 |
45 | Left brace: \{
46 |
47 | Right brace: \}
48 |
49 | Left bracket: \[
50 |
51 | Right bracket: \]
52 |
53 | Left paren: \(
54 |
55 | Right paren: \)
56 |
57 | Greater-than: \>
58 |
59 | Hash: \#
60 |
61 | Period: \.
62 |
63 | Bang: \!
64 |
65 | Plus: \+
66 |
67 | Minus: \-
68 |
69 |
70 | Nor should these, which occur in code spans:
71 | 72 |Backslash: \\
Backtick: \`
Asterisk: \*
Underscore: \_
Left brace: \{
Right brace: \}
Left bracket: \[
Right bracket: \]
Left paren: \(
Right paren: \)
Greater-than: \>
Hash: \#
Period: \.
Bang: \!
Plus: \+
Minus: \-
These should get escaped, even though they're matching pairs for 106 | other Markdown constructs:
107 | 108 |*asterisks*
109 | 110 |_underscores_
111 | 112 |`backticks`
113 | 114 |This is a code span with a literal backslash-backtick sequence: \`
This is a tag with unescaped backticks bar.
117 | 118 |This is a tag with backslashes bar.
119 | -------------------------------------------------------------------------------- /test/tests/backslash_escapes.html: -------------------------------------------------------------------------------- 1 |These should all get escaped:
2 | 3 |Backslash: \
4 | 5 |Backtick: `
6 | 7 |Asterisk: *
8 | 9 |Underscore: _
10 | 11 |Left brace: {
12 | 13 |Right brace: }
14 | 15 |Left bracket: [
16 | 17 |Right bracket: ]
18 | 19 |Left paren: (
20 | 21 |Right paren: )
22 | 23 |Greater-than: >
24 | 25 |Hash: #
26 | 27 |Period: .
28 | 29 |Bang: !
30 | 31 |Plus: +
32 | 33 |Minus: -
34 | 35 |These should not, because they occur within a code block:
36 | 37 |Backslash: \\
38 |
39 | Backtick: \`
40 |
41 | Asterisk: \*
42 |
43 | Underscore: \_
44 |
45 | Left brace: \{
46 |
47 | Right brace: \}
48 |
49 | Left bracket: \[
50 |
51 | Right bracket: \]
52 |
53 | Left paren: \(
54 |
55 | Right paren: \)
56 |
57 | Greater-than: \>
58 |
59 | Hash: \#
60 |
61 | Period: \.
62 |
63 | Bang: \!
64 |
65 | Plus: \+
66 |
67 | Minus: \-
68 |
69 |
70 | Nor should these, which occur in code spans:
71 | 72 |Backslash: \\
Backtick: \`
Asterisk: \*
Underscore: \_
Left brace: \{
Right brace: \}
Left bracket: \[
Right bracket: \]
Left paren: \(
Right paren: \)
Greater-than: \>
Hash: \#
Period: \.
Bang: \!
Plus: \+
Minus: \-
These should get escaped, even though they're matching pairs for 106 | other Markdown constructs:
107 | 108 |*asterisks*
109 | 110 |_underscores_
111 | 112 |`backticks`
113 | 114 |This is a code span with a literal backslash-backtick sequence: \`
This is a tag with unescaped backticks bar.
117 | 118 |This is a tag with backslashes bar.
119 | -------------------------------------------------------------------------------- /man/marked.1: -------------------------------------------------------------------------------- 1 | .ds q \N'34' 2 | .TH marked 1 "2014-01-31" "v0.3.1" "marked.js" 3 | 4 | .SH NAME 5 | marked \- a javascript markdown parser 6 | 7 | .SH SYNOPSIS 8 | .B marked 9 | [\-o \fI