├── .github └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── Makefile ├── Makefile.win ├── README.md ├── bin ├── common.h ├── hoedown.c └── smartypants.c ├── hoedown.def ├── html5_block_names.gperf ├── html_block_names.gperf ├── src ├── autolink.c ├── autolink.h ├── buffer.c ├── buffer.h ├── context_test.c ├── context_test.h ├── document.c ├── document.h ├── escape.c ├── escape.h ├── hash.c ├── hash.h ├── html.c ├── html.h ├── html5_blocks.c ├── html_blocks.c ├── html_smartypants.c ├── stack.c ├── stack.h ├── version.c └── version.h └── test ├── MarkdownTest_1.0.3 ├── MarkdownTest.pl └── Tests │ ├── Amps and angle encoding.html │ ├── Amps and angle encoding.text │ ├── Auto links.html │ ├── Auto links.text │ ├── Backslash escapes.html │ ├── Backslash escapes.text │ ├── Blockquotes with code blocks.html │ ├── Blockquotes with code blocks.text │ ├── Code Blocks.html │ ├── Code Blocks.text │ ├── Code Spans.html │ ├── Code Spans.text │ ├── Hard-wrapped paragraphs with list-like lines.html │ ├── Hard-wrapped paragraphs with list-like lines.text │ ├── Horizontal rules.html │ ├── Horizontal rules.text │ ├── Inline HTML (Advanced).html │ ├── Inline HTML (Advanced).text │ ├── Inline HTML (Simple).html │ ├── Inline HTML (Simple).text │ ├── Inline HTML comments.html │ ├── Inline HTML comments.text │ ├── Links, inline style.html │ ├── Links, inline style.text │ ├── Links, reference style.html │ ├── Links, reference style.text │ ├── Links, shortcut references.html │ ├── Links, shortcut references.text │ ├── Literal quotes in titles.html │ ├── Literal quotes in titles.text │ ├── Markdown Documentation - Basics.html │ ├── Markdown Documentation - Basics.text │ ├── Markdown Documentation - Syntax.html │ ├── Markdown Documentation - Syntax.text │ ├── Nested blockquotes.html │ ├── Nested blockquotes.text │ ├── Ordered and unordered lists.html │ ├── Ordered and unordered lists.text │ ├── Strong and em together.html │ ├── Strong and em together.text │ ├── Tabs.html │ ├── Tabs.text │ ├── Tidyness.html │ └── Tidyness.text ├── Tests ├── CommentsInMiddleOfLine.html ├── CommentsInMiddleOfLine.text ├── EmptyHeaders.html ├── EmptyHeaders.text ├── Escape character.html ├── Escape character.text ├── Formatting in Table of Contents.html ├── Formatting in Table of Contents.text ├── Headers.html ├── Headers.text ├── Images.html ├── Images.text ├── Math.html ├── Math.text ├── Table.html ├── Table.text ├── Underline.html ├── Underline.text ├── context │ ├── Blockcode.input │ ├── Blockcode.output │ ├── Depth.input │ ├── Depth.output │ ├── Escaping.input │ ├── Escaping.output │ ├── Footnotes.input │ ├── Footnotes.output │ ├── HRules.input │ ├── HRules.output │ ├── Headers.input │ ├── Headers.output │ ├── Links.input │ ├── Links.output │ ├── Ordered_Lists.input │ ├── Ordered_Lists.output │ ├── Unordered_Lists.input │ └── Unordered_Lists.output └── extras │ ├── Attributes.html │ ├── Attributes.text │ ├── Blockquote_Empty_Line.html │ ├── Blockquote_Empty_Line.text │ ├── Codespans.html │ ├── Codespans.text │ ├── Definition_Lists.html │ ├── Definition_Lists.text │ ├── Emphases_Intra_Underline.html │ ├── Emphases_Intra_Underline.text │ ├── Escape_Backticks.html │ ├── Escape_Backticks.text │ ├── FencedCode_Script.html │ ├── FencedCode_Script.text │ ├── Footnotes.html │ ├── Footnotes.text │ ├── HTML5_Block.html │ ├── HTML5_Block.text │ ├── HTML_Block.html │ ├── HTML_Block.text │ ├── HTML_Nested.html │ ├── HTML_Nested.text │ ├── Header_Empty.html │ ├── Header_Empty.text │ ├── Header_Empty_Attribute.html │ ├── Header_Empty_Attribute.text │ ├── Header_ID.html │ ├── Header_ID.text │ ├── Line_Continue.html │ ├── Line_Continue.text │ ├── Link_Attributes.html │ ├── Link_Attributes.text │ ├── List_Item_FencedCode.html │ ├── List_Item_FencedCode.text │ ├── List_Item_Fenced_Code_First_Line.html │ ├── List_Item_Fenced_Code_First_Line.text │ ├── List_Item_First_Line.html │ ├── List_Item_First_Line.text │ ├── Meta_Block.html │ ├── Meta_Block.text │ ├── Meta_Block_Multi.html │ ├── Meta_Block_Multi.text │ ├── More_Tables.html │ ├── More_Tables.text │ ├── Multiline_Table.html │ ├── Multiline_Table.text │ ├── Multiline_Table_Malformed.html │ ├── Multiline_Table_Malformed.text │ ├── Radio.html │ ├── Radio.text │ ├── Script_Tags.html │ ├── Script_Tags.text │ ├── Special_Attribute_Activation.html │ ├── Special_Attribute_Activation.text │ ├── Special_Attribute_CodeBlock.html │ ├── Special_Attribute_CodeBlock.text │ ├── Special_Attribute_Codespan.html │ ├── Special_Attribute_Codespan.text │ ├── Special_Attribute_Escaped.html │ ├── Special_Attribute_Escaped.text │ ├── Special_Attribute_FencedCode.html │ ├── Special_Attribute_FencedCode.text │ ├── Special_Attribute_Headers.html │ ├── Special_Attribute_Headers.text │ ├── Special_Attribute_Links.html │ ├── Special_Attribute_Links.text │ ├── Special_Attribute_Lists.html │ ├── Special_Attribute_Lists.text │ ├── Special_Attribute_Multiline_Table.html │ ├── Special_Attribute_Multiline_Table.text │ ├── Special_Attribute_Paragraphs.html │ ├── Special_Attribute_Paragraphs.text │ ├── Special_Attribute_Tables.html │ ├── Special_Attribute_Tables.text │ ├── Table_Escape_Pipe.html │ ├── Table_Escape_Pipe.text │ ├── Tasks.html │ ├── Tasks.text │ ├── Toc.html │ ├── Toc.text │ ├── Toc_Header_Empty.html │ ├── Toc_Header_Empty.text │ ├── Toc_Header_Empty_Attribute.html │ ├── Toc_Header_Empty_Attribute.text │ ├── Toc_Render.html │ ├── Toc_Render.text │ ├── issues_46.html │ ├── issues_46.text │ ├── issues_47.html │ └── issues_47.text ├── config.json ├── hoedown_fuzzer.c └── runner.py /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | name: "CodeQL" 7 | 8 | on: 9 | push: 10 | branches: [master] 11 | pull_request: 12 | # The branches below must be a subset of the branches above 13 | branches: [master] 14 | schedule: 15 | - cron: '0 1 * * 1' 16 | 17 | jobs: 18 | analyze: 19 | name: Analyze 20 | runs-on: ubuntu-latest 21 | 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | # Override automatic language detection by changing the below list 26 | # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] 27 | language: ['cpp'] 28 | # Learn more... 29 | # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection 30 | 31 | steps: 32 | - name: Checkout repository 33 | uses: actions/checkout@v2 34 | 35 | # Initializes the CodeQL tools for scanning. 36 | - name: Initialize CodeQL 37 | uses: github/codeql-action/init@v1 38 | with: 39 | languages: ${{ matrix.language }} 40 | # If you wish to specify custom queries, you can do so here or in a config file. 41 | # By default, queries listed here will override any specified in a config file. 42 | # Prefix the list here with "+" to use these queries and those in the config file. 43 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 44 | 45 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 46 | # If this step fails, then you should remove it and run the build manually (see below) 47 | - name: Autobuild 48 | uses: github/codeql-action/autobuild@v1 49 | 50 | # ℹ️ Command-line programs to run using the OS shell. 51 | # 📚 https://git.io/JvXDl 52 | 53 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 54 | # and modify them (or add more) to build your code if your project 55 | # uses a compiled language 56 | 57 | #- run: | 58 | # make bootstrap 59 | # make release 60 | 61 | - name: Perform CodeQL Analysis 62 | uses: github/codeql-action/analyze@v1 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.obj 3 | *.exe 4 | *.gcda 5 | *.gcno 6 | *.gcov 7 | hoedown 8 | hoedown.dll 9 | hoedown.exp 10 | hoedown.lib 11 | smartypants 12 | libhoedown.so* 13 | libhoedown.a 14 | -------------------------------------------------------------------------------- /.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 | - pip install --user codecov 10 | script: 11 | - make COVERAGE=1 12 | - make test 13 | 14 | after_success: 15 | # - bash <(curl -s https://codecov.io/bash) 16 | # Fixed gcov 4.6.3 in codecov 17 | - curl -s -o codecov https://codecov.io/bash 18 | - sed -i "/\.gcno/c for f in \`find \$proj_root -type f -name '*.gcno' \$gcov_ignore\`; do o=\`dirname \$f\`; \$gcov_exe \$gcovargs -pb \$f -o \$o; done" codecov 19 | - bash codecov 20 | -------------------------------------------------------------------------------- /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 | Copyright (c) 2015, Google Inc 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS = -g -O3 -std=c99 -D_DEFAULT_SOURCE -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 | ifdef COVERAGE 13 | HOEDOWN_CFLAGS := $(HOEDOWN_CFLAGS) -coverage 14 | endif 15 | 16 | SONAME = -soname 17 | ifeq ($(shell uname -s),Darwin) 18 | SONAME = -install_name 19 | endif 20 | 21 | HOEDOWN_SRC=\ 22 | src/autolink.o \ 23 | src/buffer.o \ 24 | src/context_test.o \ 25 | src/document.o \ 26 | src/escape.o \ 27 | src/html.o \ 28 | src/html_blocks.o \ 29 | src/html5_blocks.o \ 30 | src/html_smartypants.o \ 31 | src/stack.o \ 32 | src/hash.o \ 33 | src/version.o 34 | 35 | .PHONY: all test test-pl clean 36 | 37 | all: libhoedown.so libhoedown.a hoedown smartypants 38 | 39 | # Libraries 40 | 41 | libhoedown.so: libhoedown.so.3 42 | ln -f -s $^ $@ 43 | 44 | libhoedown.so.3: $(HOEDOWN_SRC) 45 | $(CC) -Wl,$(SONAME),$(@F) -shared $^ $(LDFLAGS) -o $@ 46 | 47 | libhoedown.a: $(HOEDOWN_SRC) 48 | $(AR) rcs libhoedown.a $^ 49 | 50 | # Executables 51 | 52 | hoedown: bin/hoedown.o $(HOEDOWN_SRC) 53 | $(CC) $(HOEDOWN_CFLAGS) $^ $(LDFLAGS) -o $@ 54 | 55 | smartypants: bin/smartypants.o $(HOEDOWN_SRC) 56 | $(CC) $(HOEDOWN_CFLAGS) $^ $(LDFLAGS) -o $@ 57 | 58 | # Perfect hashing 59 | 60 | src/html_blocks.c: html_block_names.gperf 61 | gperf -L ANSI-C -N hoedown_find_block_tag -c -C -E -S 1 --ignore-case -m100 $^ > $@ 62 | 63 | src/html5_blocks.c: html5_block_names.gperf 64 | gperf -L ANSI-C -N hoedown_find_html5_block_tag -c -C -E -S 1 --ignore-case -m100 $^ > $@ 65 | 66 | # Testing 67 | 68 | test: hoedown 69 | python test/runner.py 70 | 71 | test-pl: hoedown 72 | perl test/MarkdownTest_1.0.3/MarkdownTest.pl \ 73 | --script=./hoedown --testdir=test/MarkdownTest_1.0.3/Tests --tidy 74 | 75 | # Housekeeping 76 | 77 | clean: 78 | $(RM) src/*.o bin/*.o 79 | $(RM) libhoedown.so libhoedown.so.3 libhoedown.a 80 | $(RM) hoedown smartypants hoedown.exe smartypants.exe 81 | $(RM) bin/*.gc* src/*.gc* *.gcov 82 | 83 | # Installing 84 | 85 | install: 86 | install -m755 -d $(DESTDIR)$(LIBDIR) 87 | install -m755 -d $(DESTDIR)$(BINDIR) 88 | install -m755 -d $(DESTDIR)$(INCLUDEDIR) 89 | 90 | install -m644 libhoedown.a $(DESTDIR)$(LIBDIR) 91 | install -m755 libhoedown.so.3 $(DESTDIR)$(LIBDIR) 92 | ln -f -s libhoedown.so.3 $(DESTDIR)$(LIBDIR)/libhoedown.so 93 | 94 | install -m755 hoedown $(DESTDIR)$(BINDIR) 95 | install -m755 smartypants $(DESTDIR)$(BINDIR) 96 | 97 | install -m755 -d $(DESTDIR)$(INCLUDEDIR)/hoedown 98 | install -m644 src/*.h $(DESTDIR)$(INCLUDEDIR)/hoedown 99 | 100 | # Generic object compilations 101 | 102 | %.o: %.c 103 | $(CC) $(HOEDOWN_CFLAGS) -c -o $@ $< 104 | 105 | src/html_blocks.o: src/html_blocks.c 106 | $(CC) $(HOEDOWN_CFLAGS) -Wno-static-in-inline -c -o $@ $< 107 | -------------------------------------------------------------------------------- /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\hash.obj \ 14 | src\version.obj 15 | 16 | all: hoedown.dll hoedown.exe smartypants.exe 17 | 18 | hoedown.dll: $(HOEDOWN_SRC) hoedown.def 19 | $(CC) $(HOEDOWN_SRC) hoedown.def /link /DLL $(LDFLAGS) /out:$@ 20 | 21 | hoedown.exe: bin\hoedown.obj $(HOEDOWN_SRC) 22 | $(CC) bin\hoedown.obj $(HOEDOWN_SRC) /link $(LDFLAGS) /out:$@ 23 | 24 | smartypants.exe: bin\smartypants.obj $(HOEDOWN_SRC) 25 | $(CC) bin\smartypants.obj $(HOEDOWN_SRC) /link $(LDFLAGS) /out:$@ 26 | 27 | # Housekeeping 28 | 29 | clean: 30 | del $(HOEDOWN_SRC) 31 | del hoedown.dll hoedown.exp hoedown.lib 32 | del hoedown.exe smartypants.exe 33 | 34 | # Generic object compilations 35 | 36 | .c.obj: 37 | $(CC) $(CFLAGS) /c $< /Fo$@ 38 | 39 | # Testing 40 | 41 | test: hoedown.exe 42 | python test\runner.py 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hoextdown 2 | 3 | [](https://travis-ci.org/kjdev/hoextdown) 4 | [](https://codecov.io/github/kjdev/hoextdown?branch=master) 5 |  6 | 7 | `Hoextdown` is an extension to [Hoedown](https://github.com/hoedown/hoedown). 8 | 9 | Extended the following functions. 10 | 11 | * [Special Attributes](#special-attributes) 12 | * [Task Lists](#task-lists) 13 | * [Line Continue](#line-continue) 14 | * [Header ID](#header-id) 15 | * [Fenced Script](#fenced-script) 16 | * [Script Tags](#script-tags) 17 | * [Meta Block](#meta-block) 18 | * [Definition Lists](#definition-lists) 19 | 20 | ## Special Attributes 21 | 22 | Add the `HOEDOWN_EXT_SPECIAL_ATTRIBUTE` to Hoedown document flags. 23 | 24 | Set the id and class attribute on certain elements using an attribute block. 25 | 26 | For instance, put the desired id prefixed by a hash inside curly brackets after 27 | the header at the end of the line, like this 28 | 29 | ``` 30 | Header 1 {#header1} 31 | ======== 32 | 33 | ## Header 2 ## {#header2} 34 | ``` 35 | 36 | Then you can create links to different parts of the same document like this: 37 | 38 | ``` 39 | [Link back to header 1](#header1) 40 | ``` 41 | 42 | To add a class name, which can be used as a hook for a style sheet, use a dot 43 | like this: 44 | 45 | ``` 46 | ## The Site ## {.main} 47 | ``` 48 | 49 | The id and multiple class names can be combined by putting them all into the 50 | same special attribute block: 51 | 52 | ``` 53 | ## The Site ## {.main .shine #the-site} 54 | ``` 55 | 56 | To add a other than id and class names, use a colon like this: 57 | 58 | ``` 59 | ## The Site ## {.main .shine #the-site :color=red} 60 | ``` 61 | 62 | At this time, special attribute blocks can be used with 63 | 64 | * headers 65 | * fenced code blocks 66 | * links 67 | * images 68 | * tables 69 | * paragraphs 70 | 71 | For image and links, put the special attribute block immediately after the 72 | parenthesis containing the address: 73 | 74 | ``` 75 | [link](url){#id .class} 76 | {#id .class} 77 | ``` 78 | 79 | Or if using reference-style links and images, put it at the end of the 80 | definition line like this: 81 | 82 | ``` 83 | [link][linkref] or [linkref] 84 | ![img][linkref] 85 | 86 | [linkref]: url "optional title" {#id .class} 87 | ``` 88 | 89 | For paragraphs, put the special identifier `@paragraph` after the attribute. 90 | This helps prevent accidental parsing. 91 | 92 | ``` 93 | This is a paragraph. {@paragraph #id} 94 | ``` 95 | 96 | ## Task Lists 97 | 98 | Add the `HOEDOWN_HTML_USE_TASK_LIST` to Hoedown html flags. 99 | 100 | Add to support task lists, Task lists are lists with items marked as either [ ] 101 | or [x] (incomplete or complete), like this 102 | 103 | ``` 104 | - [ ] a task list item 105 | - [ ] list syntax required 106 | - [ ] normal **formatting**, @mentions, #1234 refs 107 | - [ ] incomplete 108 | - [x] completed 109 | ``` 110 | 111 | ## Line Continue 112 | 113 | Add the `HOEDOWN_HTML_LINE_CONTINUE` to Hoedown html flags. 114 | 115 | Remove the line breaks at the end of the line. 116 | 117 | ## Header ID 118 | 119 | Add the `HOEDOWN_HTML_HEADER_ID` to Hoedown html flags. 120 | 121 | Output header id. 122 | 123 | ``` 124 | # Header 1 125 | ``` 126 | 127 | becomes: 128 | 129 | ``` 130 |
This is test.
170 | 171 | 174 | ``` 175 | 176 | ## Meta Block 177 | 178 | Add the `HOEDOWN_EXT_META_BLOCK` to Hoedown document flags. 179 | 180 | Add the parsing process of meta block ``. 181 | 182 | Get a meta block by running in the following program. 183 | 184 | ```c 185 | /* 186 | Allocate meta block buffer 187 | */ 188 | hoedown_buffer *meta; 189 | meta = hoedown_buffer_new(64); 190 | 191 | /* 192 | Set HOEDOWN_EXT_META_BLOCK to hoedown_extensions. 193 | Specifies the meta block buffer to fifth argument. 194 | */ 195 | document = hoedown_document_new(renderer, HOEDOWN_EXT_META_BLOCK, 6, NULL, meta); 196 | 197 | /* 198 | Print meta block buffer 199 | */ 200 | if (meta->size > 0) { 201 | fprintf(stdout, "-- Meta Block --\n"); 202 | (void)fwrite(meta->data, 1, meta->size, stdout); 203 | } 204 | 205 | hoedown_buffer_free(meta); 206 | ``` 207 | 208 | Execution parse result. 209 | 210 | ``` 211 | 215 | 216 | This is hoextdown example. 217 | ``` 218 | 219 | becomes: 220 | 221 | ``` 222 |This is hoextdown example.
223 | --- Meta Block -- 224 | author: user 225 | title: Readme markdown parser 226 | ``` 227 | 228 | ## Definition Lists 229 | 230 | Add the `HOEXTDOWN_EXT_DEFINITION_LISTS` to Hoedown document flags. 231 | 232 | Add to support definition lists. Syntax follows [PHP Markdown Extra's syntax](https://michelf.ca/projects/php-markdown/extra/#def-list). 233 | 234 | ``` 235 | Term 236 | : Definition 237 | 238 | Term 1 239 | Term 2 240 | : Definition 2 241 | 242 | Term 3 243 | : Definition Line 1 244 | Definition Line 2 245 | 246 | Extra paragraphs need four spaces. 247 | ``` 248 | 249 | becomes: 250 | 251 | ``` 252 |Definition Line 1 Definition Line 2
261 |Extra paragraphs need four spaces.
262 |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/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/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/MarkdownTest_1.0.3/Tests/Auto links.text:
--------------------------------------------------------------------------------
1 | Link: 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/MarkdownTest_1.0.3/Tests/Backslash escapes.text: -------------------------------------------------------------------------------- 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 | 36 | 37 | These should not, because they occur within a code block: 38 | 39 | Backslash: \\ 40 | 41 | Backtick: \` 42 | 43 | Asterisk: \* 44 | 45 | Underscore: \_ 46 | 47 | Left brace: \{ 48 | 49 | Right brace: \} 50 | 51 | Left bracket: \[ 52 | 53 | Right bracket: \] 54 | 55 | Left paren: \( 56 | 57 | Right paren: \) 58 | 59 | Greater-than: \> 60 | 61 | Hash: \# 62 | 63 | Period: \. 64 | 65 | Bang: \! 66 | 67 | Plus: \+ 68 | 69 | Minus: \- 70 | 71 | 72 | Nor should these, which occur in code spans: 73 | 74 | Backslash: `\\` 75 | 76 | Backtick: `` \` `` 77 | 78 | Asterisk: `\*` 79 | 80 | Underscore: `\_` 81 | 82 | Left brace: `\{` 83 | 84 | Right brace: `\}` 85 | 86 | Left bracket: `\[` 87 | 88 | Right bracket: `\]` 89 | 90 | Left paren: `\(` 91 | 92 | Right paren: `\)` 93 | 94 | Greater-than: `\>` 95 | 96 | Hash: `\#` 97 | 98 | Period: `\.` 99 | 100 | Bang: `\!` 101 | 102 | Plus: `\+` 103 | 104 | Minus: `\-` 105 | 106 | 107 | These should get escaped, even though they're matching pairs for 108 | other Markdown constructs: 109 | 110 | \*asterisks\* 111 | 112 | \_underscores\_ 113 | 114 | \`backticks\` 115 | 116 | This is a code span with a literal backslash-backtick sequence: `` \` `` 117 | 118 | This is a tag with unescaped backticks bar. 119 | 120 | This is a tag with backslashes bar. 121 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html: -------------------------------------------------------------------------------- 1 |2 |16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Code Blocks.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 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/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/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.
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/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/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/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/Inline HTML (Advanced).html:
--------------------------------------------------------------------------------
1 | Simple block on one line:
2 | 3 |And nested without indentation:
6 | 7 |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 |Paragraph one.
2 | 3 | 4 | 5 | 8 | 9 |Paragraph two.
10 | 11 | 12 | 13 |The end.
14 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/Inline HTML comments.text: -------------------------------------------------------------------------------- 1 | Paragraph one. 2 | 3 | 4 | 5 | 8 | 9 | Paragraph two. 10 | 11 | 12 | 13 | The end. 14 | -------------------------------------------------------------------------------- /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/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 | 12 | [Empty](). 13 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/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/MarkdownTest_1.0.3/Tests/Links, reference style.text: -------------------------------------------------------------------------------- 1 | Foo [bar] [1]. 2 | 3 | Foo [bar][1]. 4 | 5 | Foo [bar] 6 | [1]. 7 | 8 | [1]: /url/ "Title" 9 | 10 | 11 | With [embedded [brackets]] [b]. 12 | 13 | 14 | Indented [once][]. 15 | 16 | Indented [twice][]. 17 | 18 | Indented [thrice][]. 19 | 20 | Indented [four][] times. 21 | 22 | [once]: /url 23 | 24 | [twice]: /url 25 | 26 | [thrice]: /url 27 | 28 | [four]: /url 29 | 30 | 31 | [b]: /url/ 32 | 33 | * * * 34 | 35 | [this] [this] should work 36 | 37 | So should [this][this]. 38 | 39 | And [this] []. 40 | 41 | And [this][]. 42 | 43 | And [this]. 44 | 45 | But not [that] []. 46 | 47 | Nor [that][]. 48 | 49 | Nor [that]. 50 | 51 | [Something in brackets like [this][] should work] 52 | 53 | [Same with [this].] 54 | 55 | In this case, [this](/somethingelse/) points to something else. 56 | 57 | Backslashing should suppress \[this] and [this\]. 58 | 59 | [this]: foo 60 | 61 | 62 | * * * 63 | 64 | Here's one where the [link 65 | breaks] across lines. 66 | 67 | Here's another where the [link 68 | breaks] across lines, but with a line-ending space. 69 | 70 | 71 | [link breaks]: /url/ 72 | -------------------------------------------------------------------------------- /test/MarkdownTest_1.0.3/Tests/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/MarkdownTest_1.0.3/Tests/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/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html: -------------------------------------------------------------------------------- 1 |Foo bar.
2 | 3 |Foo bar.
4 | -------------------------------------------------------------------------------- /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/Markdown Documentation - Basics.text: -------------------------------------------------------------------------------- 1 | Markdown: Basics 2 | ================ 3 | 4 | 11 | 12 | 13 | Getting the Gist of Markdown's Formatting Syntax 14 | ------------------------------------------------ 15 | 16 | This page offers a brief overview of what it's like to use Markdown. 17 | The [syntax page] [s] provides complete, detailed documentation for 18 | every feature, but Markdown should be very easy to pick up simply by 19 | looking at a few examples of it in action. The examples on this page 20 | are written in a before/after style, showing example syntax and the 21 | HTML output produced by Markdown. 22 | 23 | It's also helpful to simply try Markdown out; the [Dingus] [d] is a 24 | web application that allows you type your own Markdown-formatted text 25 | and translate it to XHTML. 26 | 27 | **Note:** This document is itself written using Markdown; you 28 | can [see the source for it by adding '.text' to the URL] [src]. 29 | 30 | [s]: /projects/markdown/syntax "Markdown Syntax" 31 | [d]: /projects/markdown/dingus "Markdown Dingus" 32 | [src]: /projects/markdown/basics.text 33 | 34 | 35 | ## Paragraphs, Headers, Blockquotes ## 36 | 37 | A paragraph is simply one or more consecutive lines of text, separated 38 | by one or more blank lines. (A blank line is any line that looks like a 39 | blank line -- a line containing nothing spaces or tabs is considered 40 | blank.) Normal paragraphs should not be intended with spaces or tabs. 41 | 42 | Markdown offers two styles of headers: *Setext* and *atx*. 43 | Setext-style headers for `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 |