├── test ├── Tests │ ├── Underline.text │ ├── Underline.html │ ├── Formatting in Table of Contents.text │ ├── Formatting in Table of Contents.html │ ├── Table.text │ ├── Math.text │ ├── Escape character.text │ ├── Math.html │ ├── Escape character.html │ └── Table.html ├── MarkdownTest_1.0.3 │ ├── Tests │ │ ├── Nested blockquotes.text │ │ ├── Tidyness.text │ │ ├── Strong and em together.text │ │ ├── Literal quotes in titles.text │ │ ├── Nested blockquotes.html │ │ ├── Tidyness.html │ │ ├── Code Spans.text │ │ ├── Literal quotes in titles.html │ │ ├── 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 │ │ ├── Code Blocks.text │ │ ├── Inline HTML comments.html │ │ ├── Hard-wrapped paragraphs with list-like lines.html │ │ ├── Blockquotes with code blocks.html │ │ ├── Links, inline style.text │ │ ├── Links, shortcut references.html │ │ ├── Auto links.text │ │ ├── Links, shortcut references.text │ │ ├── Code Blocks.html │ │ ├── Tabs.text │ │ ├── Links, inline style.html │ │ ├── Amps and angle encoding.text │ │ ├── Tabs.html │ │ ├── Amps and angle 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 │ │ └── Markdown Documentation - Syntax.text │ └── MarkdownTest.pl ├── runner.py └── config.json ├── .gitignore ├── .travis.yml ├── src ├── version.c ├── escape.h ├── version.h ├── stack.h ├── autolink.h ├── stack.c ├── html.h ├── buffer.h ├── escape.c ├── autolink.c ├── buffer.c ├── document.h ├── html_blocks.c ├── html_smartypants.c └── html.c ├── html_block_names.gperf ├── .editorconfig ├── LICENSE ├── hoedown.def ├── Makefile.win ├── Makefile ├── bin ├── common.h ├── smartypants.c └── hoedown.c └── README.md /test/Tests/Underline.text: -------------------------------------------------------------------------------- 1 | This _underline_ will work. 2 | -------------------------------------------------------------------------------- /test/Tests/Underline.html: -------------------------------------------------------------------------------- 1 |
This underline will work.
2 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Nested blockquotes.text: -------------------------------------------------------------------------------- 1 | > foo 2 | > 3 | > > bar 4 | > 5 | > foo 6 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Tidyness.text: -------------------------------------------------------------------------------- 1 | > A list within a blockquote: 2 | > 3 | > * asterisk 1 4 | > * asterisk 2 5 | > * asterisk 3 6 | -------------------------------------------------------------------------------- /test/Tests/Formatting in Table of Contents.text: -------------------------------------------------------------------------------- 1 | # Header with special & characters 2 | 3 | ## With `Code` 4 | 5 | ### With *Emphasis* 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.obj 3 | *.exe 4 | hoedown 5 | hoedown.dll 6 | hoedown.exp 7 | hoedown.lib 8 | smartypants 9 | libhoedown.so* 10 | libhoedown.a 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | compiler: 3 | - clang 4 | - gcc 5 | perl: 6 | - "5.12" 7 | before_install: 8 | - sudo apt-get install -qq tidy 9 | script: make test 10 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/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/MarkdownTest_1.0.3/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/MarkdownTest_1.0.3/Tests/Nested blockquotes.html: -------------------------------------------------------------------------------- 1 |2 |10 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Tidyness.html: -------------------------------------------------------------------------------- 1 |foo
3 | 4 |5 |7 | 8 |bar
6 |foo
9 |
2 |9 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Code Spans.text: -------------------------------------------------------------------------------- 1 | `A list within a blockquote:
3 |4 |
8 |- asterisk 1
5 |- asterisk 2
6 |- asterisk 3
7 |
Foo bar.
2 | 3 |Foo bar.
4 | -------------------------------------------------------------------------------- /src/version.c: -------------------------------------------------------------------------------- 1 | #include "version.h" 2 | 3 | void 4 | hoedown_version(int *major, int *minor, int *revision) 5 | { 6 | *major = HOEDOWN_VERSION_MAJOR; 7 | *minor = HOEDOWN_VERSION_MINOR; 8 | *revision = HOEDOWN_VERSION_REVISION; 9 | } 10 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text: -------------------------------------------------------------------------------- 1 | > Example: 2 | > 3 | > sub status { 4 | > print "working"; 5 | > } 6 | > 7 | > Or: 8 | > 9 | > sub status { 10 | > return "working"; 11 | > } 12 | -------------------------------------------------------------------------------- /html_block_names.gperf: -------------------------------------------------------------------------------- 1 | p 2 | dl 3 | h1 4 | h2 5 | h3 6 | h4 7 | h5 8 | h6 9 | ol 10 | ul 11 | del 12 | div 13 | ins 14 | pre 15 | form 16 | math 17 | style 18 | table 19 | figure 20 | iframe 21 | script 22 | fieldset 23 | noscript 24 | blockquote 25 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/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 |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/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.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/MarkdownTest_1.0.3/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 -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Inline HTML comments.html: -------------------------------------------------------------------------------- 1 |Paragraph one.
2 | 3 | 4 | 5 | 8 | 9 |Paragraph two.
10 | 11 | 12 | 13 |The end.
14 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/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/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html: -------------------------------------------------------------------------------- 1 |2 |16 | -------------------------------------------------------------------------------- /test/Tests/Formatting in Table of Contents.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 |
Code
7 | 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/MarkdownTest_1.0.3/Tests/Auto links.text: -------------------------------------------------------------------------------- 1 | Link: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/MarkdownTest_1.0.3/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/MarkdownTest_1.0.3/Tests/Links, inline style.html:
--------------------------------------------------------------------------------
1 | Just a URL.
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text: -------------------------------------------------------------------------------- 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] [1] with an ampersand in the URL. 12 | 13 | Here's a link with an amersand in the link text: [AT&T] [2]. 14 | 15 | Here's an inline [link](/script?foo=1&bar=2). 16 | 17 | Here's an inline [link](). 18 | 19 | 20 | [1]: http://example.com/?foo=1&bar=2 21 | [2]: http://att.com/ "AT&T" -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/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/MarkdownTest_1.0.3/Tests/Amps and angle 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/MarkdownTest_1.0.3/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/MarkdownTest_1.0.3/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 |
--------------------------------------------------------------------------------
/src/escape.h:
--------------------------------------------------------------------------------
1 | /* escape.h - escape utilities */
2 |
3 | #ifndef HOEDOWN_ESCAPE_H
4 | #define HOEDOWN_ESCAPE_H
5 |
6 | #include "buffer.h"
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 |
13 | /*************
14 | * FUNCTIONS *
15 | *************/
16 |
17 | /* hoedown_escape_href: escape (part of) a URL inside HTML */
18 | void hoedown_escape_href(hoedown_buffer *ob, const uint8_t *data, size_t size);
19 |
20 | /* hoedown_escape_html: escape HTML */
21 | void hoedown_escape_html(hoedown_buffer *ob, const uint8_t *data, size_t size, int secure);
22 |
23 |
24 | #ifdef __cplusplus
25 | }
26 | #endif
27 |
28 | #endif /** HOEDOWN_ESCAPE_H **/
29 |
--------------------------------------------------------------------------------
/src/version.h:
--------------------------------------------------------------------------------
1 | /* version.h - holds Hoedown's version */
2 |
3 | #ifndef HOEDOWN_VERSION_H
4 | #define HOEDOWN_VERSION_H
5 |
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 |
10 |
11 | /*************
12 | * CONSTANTS *
13 | *************/
14 |
15 | #define HOEDOWN_VERSION "3.0.5"
16 | #define HOEDOWN_VERSION_MAJOR 3
17 | #define HOEDOWN_VERSION_MINOR 0
18 | #define HOEDOWN_VERSION_REVISION 5
19 |
20 |
21 | /*************
22 | * FUNCTIONS *
23 | *************/
24 |
25 | /* hoedown_version: retrieve Hoedown's version numbers */
26 | void hoedown_version(int *major, int *minor, int *revision);
27 |
28 |
29 | #ifdef __cplusplus
30 | }
31 | #endif
32 |
33 | #endif /** HOEDOWN_VERSION_H **/
34 |
--------------------------------------------------------------------------------
/test/Tests/Math.text:
--------------------------------------------------------------------------------
1 | \\[
2 | 1*2*3 multi-line math
3 | \\]
4 |
5 | \\( 1*2*3 inline-math \\)
6 |
7 | $$ 1*2*3 math with dollar $$
8 |
9 | $$ 1*2*3 \$ \\ \text{dollar with escapes} $$
10 |
11 | \\( \\ \text{backslash with escapes} \$ 1*2*3 \\)
12 |
13 | \( not *really* math \)
14 |
15 | \$$ also *not* math \$$
16 |
17 | this $$*should* be$$ math
18 |
19 | this$$ *should* also be$$ math
20 |
21 | and $$this *should* $$too
22 |
23 | Something \\{ like *math* but \\} is not
24 |
25 | Also \\\(like *math* but \\\) is not
26 |
27 | \\\\( should be *math* as well \\\\)
28 |
29 | This is \\( math, and the \\\( inner one \\\) should be \\) preserved
30 |
31 | $$ did you know this is math? $$
32 |
--------------------------------------------------------------------------------
/test/Tests/Escape character.text:
--------------------------------------------------------------------------------
1 | \==Highlight\==
2 |
3 | \~~Strikethrough\~~
4 |
5 | \_Underscore\_
6 |
7 | \__Underscore\__
8 |
9 | _\_Underscore_\_
10 |
11 | \__Underscore_\_
12 |
13 | _\_Underscore\__
14 |
15 | \*Asterisk\*
16 |
17 | \**Asterisk\**
18 |
19 | \**Asterisk*\*
20 |
21 | *\*Asterisk\**
22 |
23 | *\*Asterisk*\*
24 |
25 | \[Bracket\]
26 |
27 | \(Parenthesis\)
28 |
29 | \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/Tests/Math.html:
--------------------------------------------------------------------------------
1 | \[ 2 | 1*2*3 multi-line math 3 | \]
4 | 5 |\( 1*2*3 inline-math \)
6 | 7 |\[ 1*2*3 math with dollar \]
8 | 9 |\[ 1*2*3 \$ \\ \text{dollar with escapes} \]
10 | 11 |\( \\ \text{backslash with escapes} \$ 1*2*3 \)
12 | 13 |( not really math )
14 | 15 |$$ also not math $$
16 | 17 |this \(*should* be\) math
18 | 19 |this\( *should* also be\) math
20 | 21 |and \(this *should* \)too
22 | 23 |Something \{ like math but \} is not
24 | 25 |Also \(like math but \) is not
26 | 27 |\\( should be *math* as well \\\)
28 | 29 |This is \( math, and the \\\( inner one \\\) should be \) preserved
30 | 31 |\[ did you <em> know </em> this is math? \]
32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008, Natacha Porté 2 | Copyright (c) 2011, Vicent Martí 3 | Copyright (c) 2014, Xavier Mendez, Devin Torres and the Hoedown authors 4 | 5 | Permission to use, copy, modify, and distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text: -------------------------------------------------------------------------------- 1 | Here's a simple block: 2 | 3 |==Highlight==
2 | 3 |~~Strikethrough~~
4 | 5 |_Underscore_
6 | 7 |_Underscore_
8 | 9 |_Underscore_
10 | 11 |_Underscore_
12 | 13 |_Underscore_
14 | 15 |*Asterisk*
16 | 17 |*Asterisk*
18 | 19 |*Asterisk*
20 | 21 |*Asterisk*
22 | 23 |*Asterisk*
24 | 25 |[Bracket]
26 | 27 |(Parenthesis)
28 | 29 |<Chevron>
30 | 31 |Super^script
32 | 33 |`Backtick`
34 | 35 |"Quote"
36 | 37 |Foo\
38 | 39 |Foo\*
40 | 41 |Foo\\Bar\
42 | 43 |*Foo\Bar\*
44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /hoedown.def: -------------------------------------------------------------------------------- 1 | LIBRARY HOEDOWN 2 | EXPORTS 3 | hoedown_autolink_is_safe 4 | hoedown_autolink__www 5 | hoedown_autolink__email 6 | hoedown_autolink__url 7 | hoedown_buffer_init 8 | hoedown_buffer_new 9 | hoedown_buffer_reset 10 | hoedown_buffer_grow 11 | hoedown_buffer_put 12 | hoedown_buffer_puts 13 | hoedown_buffer_putc 14 | hoedown_buffer_set 15 | hoedown_buffer_sets 16 | hoedown_buffer_eq 17 | hoedown_buffer_eqs 18 | hoedown_buffer_prefix 19 | hoedown_buffer_slurp 20 | hoedown_buffer_cstr 21 | hoedown_buffer_printf 22 | hoedown_buffer_free 23 | hoedown_document_new 24 | hoedown_document_render 25 | hoedown_document_render_inline 26 | hoedown_document_free 27 | hoedown_escape_href 28 | hoedown_escape_html 29 | hoedown_html_smartypants 30 | hoedown_html_is_tag 31 | hoedown_html_renderer_new 32 | hoedown_html_toc_renderer_new 33 | hoedown_html_renderer_free 34 | hoedown_stack_init 35 | hoedown_stack_uninit 36 | hoedown_stack_grow 37 | hoedown_stack_push 38 | hoedown_stack_pop 39 | hoedown_stack_top 40 | hoedown_version 41 | -------------------------------------------------------------------------------- /Makefile.win: -------------------------------------------------------------------------------- 1 | CC = cl 2 | CFLAGS = /O2 /sdl /Isrc /D_CRT_SECURE_NO_WARNINGS 3 | 4 | HOEDOWN_SRC = \ 5 | src\autolink.obj \ 6 | src\buffer.obj \ 7 | src\document.obj \ 8 | src\escape.obj \ 9 | src\html.obj \ 10 | src\html_blocks.obj \ 11 | src\html_smartypants.obj \ 12 | src\stack.obj \ 13 | src\version.obj 14 | 15 | all: hoedown.dll hoedown.exe smartypants.exe 16 | 17 | hoedown.dll: $(HOEDOWN_SRC) hoedown.def 18 | $(CC) $(HOEDOWN_SRC) hoedown.def /link /DLL $(LDFLAGS) /out:$@ 19 | 20 | hoedown.exe: bin\hoedown.obj $(HOEDOWN_SRC) 21 | $(CC) bin\hoedown.obj $(HOEDOWN_SRC) /link $(LDFLAGS) /out:$@ 22 | 23 | smartypants.exe: bin\smartypants.obj $(HOEDOWN_SRC) 24 | $(CC) bin\smartypants.obj $(HOEDOWN_SRC) /link $(LDFLAGS) /out:$@ 25 | 26 | # Housekeeping 27 | 28 | clean: 29 | del $(HOEDOWN_SRC) 30 | del hoedown.dll hoedown.exp hoedown.lib 31 | del hoedown.exe smartypants.exe 32 | 33 | # Generic object compilations 34 | 35 | .c.obj: 36 | $(CC) $(CFLAGS) /c $< /Fo$@ 37 | 38 | # Testing 39 | 40 | test: hoedown.exe 41 | python test\runner.py 42 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html: -------------------------------------------------------------------------------- 1 |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 || headline1 | 7 |headline2 | 8 |
|---|---|
| 123 | 13 |14 | |
| headline1 | 25 |headline2 | 26 |headline3 | 27 |
|---|---|---|
| 123 | 32 |33 | | 34 | |
| headline1 | 45 |headline2 | 46 |headline3 | 47 |
|---|---|---|
| 12 | 52 |53 | | 54 | |
| 34 | 57 |58 | | 59 | |
| 56 | 62 |63 | | 64 | |
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 | -------------------------------------------------------------------------------- /src/stack.c: -------------------------------------------------------------------------------- 1 | #include "stack.h" 2 | 3 | #include "buffer.h" 4 | 5 | #includeThese 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 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS = -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter 2 | PREFIX = /usr/local 3 | BINDIR = $(PREFIX)/bin 4 | LIBDIR = $(PREFIX)/lib 5 | INCLUDEDIR = $(PREFIX)/include 6 | 7 | HOEDOWN_CFLAGS = $(CFLAGS) -Isrc 8 | ifneq ($(OS),Windows_NT) 9 | HOEDOWN_CFLAGS += -fPIC 10 | endif 11 | 12 | HOEDOWN_SRC=\ 13 | src/autolink.o \ 14 | src/buffer.o \ 15 | src/document.o \ 16 | src/escape.o \ 17 | src/html.o \ 18 | src/html_blocks.o \ 19 | src/html_smartypants.o \ 20 | src/stack.o \ 21 | src/version.o 22 | 23 | .PHONY: all test test-pl clean 24 | 25 | all: libhoedown.so libhoedown.a hoedown smartypants 26 | 27 | # Libraries 28 | 29 | libhoedown.so: libhoedown.so.3 30 | ln -f -s $^ $@ 31 | 32 | libhoedown.so.3: $(HOEDOWN_SRC) 33 | $(CC) -Wl,-soname,$(@F) -shared $^ $(LDFLAGS) -o $@ 34 | 35 | libhoedown.a: $(HOEDOWN_SRC) 36 | $(AR) rcs libhoedown.a $^ 37 | 38 | # Executables 39 | 40 | hoedown: bin/hoedown.o $(HOEDOWN_SRC) 41 | $(CC) $^ $(LDFLAGS) -o $@ 42 | 43 | smartypants: bin/smartypants.o $(HOEDOWN_SRC) 44 | $(CC) $^ $(LDFLAGS) -o $@ 45 | 46 | # Perfect hashing 47 | 48 | src/html_blocks.c: html_block_names.gperf 49 | gperf -L ANSI-C -N hoedown_find_block_tag -c -C -E -S 1 --ignore-case -m100 $^ > $@ 50 | 51 | # Testing 52 | 53 | test: hoedown 54 | python test/runner.py 55 | 56 | test-pl: hoedown 57 | perl test/MarkdownTest_1.0.3/MarkdownTest.pl \ 58 | --script=./hoedown --testdir=test/MarkdownTest_1.0.3/Tests --tidy 59 | 60 | # Housekeeping 61 | 62 | clean: 63 | $(RM) src/*.o bin/*.o 64 | $(RM) libhoedown.so libhoedown.so.1 libhoedown.a 65 | $(RM) hoedown smartypants hoedown.exe smartypants.exe 66 | 67 | # Installing 68 | 69 | install: 70 | install -m755 -d $(DESTDIR)$(LIBDIR) 71 | install -m755 -d $(DESTDIR)$(BINDIR) 72 | install -m755 -d $(DESTDIR)$(INCLUDEDIR) 73 | 74 | install -m644 libhoedown.a $(DESTDIR)$(LIBDIR) 75 | install -m755 libhoedown.so.3 $(DESTDIR)$(LIBDIR) 76 | ln -f -s libhoedown.so.3 $(DESTDIR)$(LIBDIR)/libhoedown.so 77 | 78 | install -m755 hoedown $(DESTDIR)$(BINDIR) 79 | install -m755 smartypants $(DESTDIR)$(BINDIR) 80 | 81 | install -m755 -d $(DESTDIR)$(INCLUDEDIR)/hoedown 82 | install -m644 src/*.h $(DESTDIR)$(INCLUDEDIR)/hoedown 83 | 84 | # Generic object compilations 85 | 86 | %.o: %.c 87 | $(CC) $(HOEDOWN_CFLAGS) -c -o $@ $< 88 | 89 | src/html_blocks.o: src/html_blocks.c 90 | $(CC) $(HOEDOWN_CFLAGS) -Wno-static-in-inline -c -o $@ $< 91 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html: -------------------------------------------------------------------------------- 1 |Asterisks tight:
4 | 5 |Asterisks loose:
12 | 13 |asterisk 1
asterisk 2
asterisk 3
Pluses tight:
22 | 23 |Pluses loose:
30 | 31 |Plus 1
Plus 2
Plus 3
Minuses tight:
40 | 41 |Minuses loose:
48 | 49 |Minus 1
Minus 2
Minus 3
Tight:
58 | 59 |and:
66 | 67 |Loose using tabs:
74 | 75 |First
Second
Third
and using spaces:
82 | 83 |One
Two
Three
Multiple paragraphs:
90 | 91 |Item 1, graf one.
93 | 94 |Item 2. graf two. The quick brown fox jumped over the lazy dog's 95 | back.
Item 2.
Item 3.
Here's another:
113 | 114 |Same thing but with paragraphs:
126 | 127 |First
Second:
130 | 131 |Third
This was an error in Markdown 1.0.1:
141 | 142 |this
144 | 145 |that
Now is the time for all good men to come to 82 | the aid of their country. This is just a 83 | regular paragraph.
84 | 85 |The quick brown fox jumped over the lazy 86 | dog's back.
87 | 88 |91 |97 | 98 | 99 | 100 | ### Phrase Emphasis ### 101 | 102 | Markdown uses asterisks and underscores to indicate spans of emphasis. 103 | 104 | Markdown: 105 | 106 | Some of these words *are emphasized*. 107 | Some of these words _are emphasized also_. 108 | 109 | Use two asterisks for **strong emphasis**. 110 | Or, if you prefer, __use two underscores instead__. 111 | 112 | Output: 113 | 114 |This is a blockquote.
92 | 93 |This is the second paragraph in the blockquote.
94 | 95 |This is an H2 in a blockquote
96 |
Some of these words are emphasized. 115 | Some of these words are emphasized also.
116 | 117 |Use two asterisks for strong emphasis. 118 | Or, if you prefer, use two underscores instead.
119 | 120 | 121 | 122 | ## Lists ## 123 | 124 | Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, 125 | `+`, and `-`) as list markers. These three markers are 126 | interchangable; this: 127 | 128 | * Candy. 129 | * Gum. 130 | * Booze. 131 | 132 | this: 133 | 134 | + Candy. 135 | + Gum. 136 | + Booze. 137 | 138 | and this: 139 | 140 | - Candy. 141 | - Gum. 142 | - Booze. 143 | 144 | all produce the same output: 145 | 146 |` tags for the 168 | list item text. You can create multi-paragraph list items by indenting 169 | the paragraphs by 4 spaces or 1 tab: 170 | 171 | * A list item. 172 | 173 | With multiple paragraphs. 174 | 175 | * Another item in the list. 176 | 177 | Output: 178 | 179 |
A list item.
181 |With multiple paragraphs.
Another item in the list.
This is an 201 | example link.
202 | 203 | Optionally, you may include a title attribute in the parentheses: 204 | 205 | This is an [example link](http://example.com/ "With a Title"). 206 | 207 | Output: 208 | 209 |This is an 210 | example link.
211 | 212 | Reference-style links allow you to refer to your links by names, which 213 | you define elsewhere in your document: 214 | 215 | I get 10 times more traffic from [Google][1] than from 216 | [Yahoo][2] or [MSN][3]. 217 | 218 | [1]: http://google.com/ "Google" 219 | [2]: http://search.yahoo.com/ "Yahoo Search" 220 | [3]: http://search.msn.com/ "MSN Search" 221 | 222 | Output: 223 | 224 |I get 10 times more traffic from Google than from Yahoo or MSN.
228 | 229 | The title attribute is optional. Link names may contain letters, 230 | numbers and spaces, but are *not* case sensitive: 231 | 232 | I start my morning with a cup of coffee and 233 | [The New York Times][NY Times]. 234 | 235 | [ny times]: http://www.nytimes.com/ 236 | 237 | Output: 238 | 239 |I start my morning with a cup of coffee and 240 | The New York Times.
241 | 242 | 243 | ### Images ### 244 | 245 | Image syntax is very much like link syntax. 246 | 247 | Inline (titles are optional): 248 | 249 |  250 | 251 | Reference-style: 252 | 253 | ![alt text][id] 254 | 255 | [id]: /path/to/img.jpg "Title" 256 | 257 | Both of the above examples produce the same output: 258 | 259 |
260 |
261 |
262 |
263 | ### Code ###
264 |
265 | In a regular paragraph, you can create code span by wrapping text in
266 | backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
267 | `>`) will automatically be translated into HTML entities. This makes
268 | it easy to use Markdown to write about HTML example code:
269 |
270 | I strongly recommend against using any `