├── CNAME ├── dingus ├── preview.html ├── Makefile ├── dingus.css ├── index.html ├── dingus.js └── bootstrap.min.js ├── current ├── index.html └── index.html.in ├── dingus.html ├── js ├── index.html └── LICENSE ├── Makefile ├── make_site_index.sh ├── template.html ├── changelog.spec.txt ├── index.html ├── 0.12 └── changes.html ├── changelog.txt ├── 0.25 └── changes.html ├── 0.15 └── changes.html └── 0.17 └── changes.html /CNAME: -------------------------------------------------------------------------------- 1 | spec.commonmark.org 2 | -------------------------------------------------------------------------------- /dingus/preview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | commonmark.js preview 6 | 7 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /current/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Redirecting... 4 | 5 | 6 |

Redirecting...

7 | Click here if you are not redirected. 8 | 9 | -------------------------------------------------------------------------------- /current/index.html.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | Redirecting... 4 | 5 | 6 |

Redirecting...

7 | Click here if you are not redirected. 8 | 9 | -------------------------------------------------------------------------------- /dingus.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CommonMark dingus 5 | 7 | 8 | 9 |

The most recent version of the CommonMark dingus can be found 10 | at http://spec.commonmark.org/dingus/.

12 | 13 | 14 | -------------------------------------------------------------------------------- /js/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CommonMark dingus 5 | 7 | 8 | 9 |

The most recent version of the CommonMark dingus can be found 10 | at http://spec.commonmark.org/dingus/.

12 | 13 | 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | MAINREPO?=../CommonMark 2 | JSREPO?=../commonmark.js 3 | SPECVERSION=$(shell grep version: $(MAINREPO)/spec.txt | sed -e 's/version: *//') 4 | 5 | all: update current/index.html 6 | git tag --list | grep -q -v $(SPECVERSION) ; \ 7 | mkdir -p $(SPECVERSION) ; \ 8 | make -C $(MAINREPO) spec.html ; \ 9 | cp $(MAINREPO)/spec.html $(SPECVERSION)/index.html; \ 10 | cp $(MAINREPO)/spec.txt $(SPECVERSION)/spec.txt; \ 11 | cp $(SPECVERSION)/index.html spec.html; \ 12 | ./make_site_index.sh $(SPECVERSION) | \ 13 | pandoc --template template.html -S -s -t html5 -o index.html ; \ 14 | git add spec.html $(SPECVERSION)/index.html $(SPECVERSION)/changes.html $(SPECVERSION)/spec.txt ; \ 15 | git commit -a -m "Updated to version $(SPECVERSION) of spec"; \ 16 | git tag $(SPECVERSION) HEAD 17 | 18 | current/index.html: current/index.html.in 19 | sed -e "s/VERSION/$(SPECVERSION)/g" $< > $@ 20 | 21 | update: 22 | make -C $(JSREPO)/dingus ; \ 23 | cp -r $(JSREPO)/dingus . ; \ 24 | cp $(JSREPO)/dist/commonmark.js js/commonmark.js; \ 25 | cp $(JSREPO)/LICENSE js/LICENSE; \ 26 | cp $(MAINREPO)/changelog.txt changelog.txt; \ 27 | 28 | upload: 29 | git pull; git push; git push --tags 30 | 31 | -------------------------------------------------------------------------------- /dingus/Makefile: -------------------------------------------------------------------------------- 1 | ALL=commonmark.js 2 | COMPONENTS=lodash.min.js jquery.min.js jquery.min.map bootstrap.min.js bootstrap.min.css 3 | LIBFILES=../lib/blocks.js ../lib/common.js ../lib/from-code-point.js ../lib/html.js ../lib/inlines.js ../lib/index.js ../lib/node.js ../lib/normalize-reference.js ../lib/xml.js 4 | 5 | all: $(ALL) components 6 | 7 | .PHONY: all dingus components clean 8 | 9 | components: $(COMPONENTS) 10 | 11 | bower_components/%: 12 | bower install $(notdir $@) 13 | 14 | lodash.min.js: bower_components/lodash 15 | cp $' $SPECVERSION/index.html | perl -pe 's/^.*(\d\d\d\d-\d\d-\d\d).*$/\1/'` 9 | echo "[**Latest version ($SPECVERSION)**]($SPECVERSION/) ($date) ([view changes]($SPECVERSION/changes.html 'See changes from previous version'))" 10 | echo "" 11 | echo "[discussion forum](http://talk.commonmark.org/) | " 12 | echo "[interactive dingus](dingus/) | " 13 | echo "[repository](https://github.com/jgm/CommonMark/) | " 14 | echo "[changelog](changelog.txt)" 15 | echo "" 16 | echo "Older versions:" 17 | echo "" 18 | for vers in $VERSIONS 19 | do 20 | date=`grep '
' $vers/index.html | perl -pe 's/^.*(\d\d\d\d-\d\d-\d\d).*$/\1/'` 21 | if [ "$vers" != "$SPECVERSION" ]; then 22 | perl -p -i -e 's/
.*?<\/div>/
This is an older version of the spec. For the most recent version, see http:\/\/spec.commonmark.org<\/a>.<\/div>/' $vers/index.html 23 | changes="" 24 | [ -f $vers/changes.html ] && changes=" ([view changes]($vers/changes.html 'See changes from previous version'))" 25 | echo "- [$vers]($vers/) ($date)$changes" 26 | fi 27 | done | sort -r -k3 | tee PREVIOUS 28 | PREV_VERSION=`head -1 PREVIOUS | perl -pe 's/- \[([^]]*).*/\1/'` 29 | rfcdiff --html --width 80 --stdout $PREV_VERSION/spec.txt $SPECVERSION/spec.txt | perl -pe 's/charset=iso-8859-1/charset=utf-8/' > $SPECVERSION/changes.html 30 | -------------------------------------------------------------------------------- /dingus/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | commonmark.js demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |

commonmark.js dingus

18 |
19 |
20 |
21 |
22 |

clear     24 | 25 | 26 |

27 | 39 |
    40 |
    41 |
    42 | 47 |
    48 |
    49 | 50 |
    51 |
    52 |
    53 |
    54 |
    55 |
    56 |
    57 |
    58 |
    Parsed in 59 | ms. Rendered in ms.
    60 |
    61 |
    62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $title$ 6 | 72 | 73 | 74 | 75 | $if(title)$ 76 |

    $title$

    77 | $endif$ 78 | $if(version)$ 79 |
    Version $version$ ($date$)
    80 | $endif$ 81 |
    82 | $for(author)$$author$$sep$; $endfor$ 83 |
    84 |
    85 | Creative
 87 |    Commons BY-SA
    CommonMark Spec by 92 | John MacFarlane is licensed under a 95 | Creative 97 | Commons Attribution-ShareAlike 4.0 International License. 98 |
    99 |
    100 | $toc$ 101 |
    102 |
    103 | $body$ 104 | 105 | 106 | -------------------------------------------------------------------------------- /changelog.spec.txt: -------------------------------------------------------------------------------- 1 | [0.16] 2 | 3 | * Rewrote beginning of Entities section, clarifying that only 4 | entities not in code blocks or spans are decoded. 5 | * Removed defective Example 449 (#284). 6 | * Fixed typo (#283). 7 | * Added intended two-space hard-breaks in Examples 521, 523. 8 | * Clarified that brackets in general don't take precedence over emph 9 | (#258). 10 | * Clarified that final newline is removed from paragraph content 11 | (#176). 12 | * Talk of "info string" rather than "attributes" for code blocks 13 | (#262). 14 | * Clarified precedence of code spans, HTML tags, autolinks (#259). 15 | * Fixed a number of internal links and duplicate references in the spec. 16 | * Linkify "info string" in spec. 17 | * Use shortcut reference links when possible in spec.txt. 18 | * cmark itself is now used to build spec.html, rather than pandoc. 19 | * Use shortcut reference links when possible in spec.txt. This 20 | relies on the new `spec2md.py` behavior of creating references 21 | for all internal anchors. 22 | * Moved some examples from block to inline HTML section. 23 | * Added examples of non-comments (#264). 24 | * Changed rule for comments to conform to HTML5 spec. 25 | * Made clear that any sequence of characters is a valid document 26 | (#266). 27 | * Changed wording: "is preferred" -> "takes precedence." 28 | * Regularized spelling of "non-space character" and added links 29 | (#260). 30 | * Use four spaces rather than five to show "four spaces is too much" 31 | (#261). 32 | 33 | [0.15] 34 | 35 | * Fixed some typos with "left-" and "right-flanking" delimiters in the 36 | section on emphasis and strong emphasis (#257). 37 | 38 | [0.14] 39 | 40 | * Clarified indented code blocks. Previously the spec said, wrongly, 41 | that a blank line was needed between a paragraph and a following 42 | code block. It is only needed between a code block and a following 43 | paragraph (due to lazy continuations). (Thanks to textnut.) 44 | * Added definitions of whitespace, unicode whitespace, punctuation, 45 | ASCII punctuation (#108). 46 | * Improved rules for emphasis and strong emphasis. This improves 47 | parsing of emphasis around punctuation. For background see 48 | . The basic idea of the change 49 | is that if the delimiter is part of a delimiter clump that has 50 | punctuation to the left and a normal character (non-space, 51 | non-punctuation) to the right, it can only be an opener. If it has 52 | punctuation to the right and a normal character (non-space, 53 | non-punctuation) to the left, it can only be a closer. This handles 54 | cases like 55 | 56 | **Gomphocarpus (*Gomphocarpus physocarpus*, syn. *Asclepias 57 | physocarpa*)** 58 | 59 | and 60 | 61 | **foo "*bar*" foo** 62 | 63 | better than before. 64 | * Added test case for link-in-link-in-image (#252). 65 | * Fixed broken internal references. 66 | * Added another example of an unclarity in the canonical Markdown 67 | syntax description. 68 | * Reworded the principle of uniformity to be more general; it applies 69 | to all container blocks, not just list items. 70 | * Added a rule for empty list items (#242). 71 | * Clarified precedence of empty list items over setext header lines 72 | (#95). 73 | * Added an example with two blank lines in fenced code in a sublist (#180). 74 | * Added an explicit CC-BY-SA license to the spec (#55). 75 | 76 | [0.13] 77 | 78 | * Updated path of test program. 79 | * Use terminology "plain textual content" instead of "string." 80 | * Added condition that conforming parsers strip or replace NULL characters. 81 | * Changed Example 196 to reflect the spec's rules. It should not be a loose 82 | list as it has no blank lines. 83 | * Adjusted semantically insignificant formatting of HTML output. 84 | * Added example to spec of shortcut link with following space (#214). 85 | -------------------------------------------------------------------------------- /dingus/dingus.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /*eslint-env browser*/ 4 | /*global $, _ */ 5 | 6 | var commonmark = window.commonmark; 7 | var writer = new commonmark.HtmlRenderer({ sourcepos: true }); 8 | var htmlwriter = new commonmark.HtmlRenderer({ sourcepos: false }); 9 | var xmlwriter = new commonmark.XmlRenderer({ sourcepos: false }); 10 | var reader = new commonmark.Parser(); 11 | 12 | function getQueryVariable(variable) { 13 | var query = window.location.search.substring(1); 14 | var vars = query.split("&"); 15 | for (var i = 0; i < vars.length; i++) { 16 | var pair = vars[i].split("="); 17 | if (pair[0] === variable){ 18 | return decodeURIComponent(pair[1]); 19 | } 20 | } 21 | return null; 22 | } 23 | 24 | var render = function(parsed) { 25 | if (parsed === undefined) { 26 | return; 27 | } 28 | var startTime = new Date().getTime(); 29 | var result = writer.render(parsed); 30 | var endTime = new Date().getTime(); 31 | var renderTime = endTime - startTime; 32 | var preview = $("#preview iframe").contents().find('body'); 33 | preview.get(0).innerHTML = result; 34 | $("#html").text(htmlwriter.render(parsed)); 35 | $("#ast").text(xmlwriter.render(parsed)); 36 | $("#rendertime").text(renderTime); 37 | }; 38 | 39 | var syncScroll = function() { 40 | var textarea = $("#text"); 41 | var preview = $("#preview iframe").contents().find('body'); 42 | var lineHeight = parseFloat(textarea.css('line-height')); 43 | // NOTE this assumes we don't have wrapped lines, 44 | // so we have set white-space:nowrap on the textarea: 45 | var lineNumber = Math.floor(textarea.scrollTop() / lineHeight) + 1; 46 | var elt = preview.find("*[data-sourcepos^='" + lineNumber + ":']").last(); 47 | if (elt.length > 0) { 48 | if (elt.offset()) { 49 | console.log("Moving scrollTop to ", elt.offset().top - 100); 50 | preview.animate({ 51 | scrollTop: elt.offset().top - 100 52 | }, 50); 53 | } 54 | } 55 | }; 56 | 57 | var markSelection = function() { 58 | var cursorPos = $("#text").prop("selectionStart"); 59 | // now count newline up to this pos 60 | var textval = $("#text").val(); 61 | var lineNumber = 1; 62 | for (var i = 0; i < cursorPos; i++) { 63 | if (textval.charAt(i) === '\n') { 64 | lineNumber++; 65 | } 66 | } 67 | var preview = $("#preview iframe").contents().find('body'); 68 | var elt = preview.find("[data-sourcepos^='" + lineNumber + ":']").last(); 69 | if (elt.length > 0) { 70 | preview.find(".selected").removeClass("selected"); 71 | elt.addClass("selected"); 72 | } 73 | syncScroll(); 74 | }; 75 | 76 | var parseAndRender = function() { 77 | var textarea = $("#text"); 78 | var startTime = new Date().getTime(); 79 | var parsed = reader.parse(textarea.val()); 80 | var endTime = new Date().getTime(); 81 | var parseTime = endTime - startTime; 82 | $("#parsetime").text(parseTime); 83 | $(".timing").css('visibility', 'visible'); 84 | render(parsed); 85 | markSelection(); 86 | }; 87 | 88 | $(document).ready(function() { 89 | $('iframe').load( function() { 90 | var textarea = $("#text"); 91 | var initial_text = getQueryVariable("text"); 92 | var smartSelected = getQueryVariable("smart") === "1"; 93 | $("#smart").prop('checked', smartSelected); 94 | reader.options.smart = smartSelected; 95 | if (initial_text) { 96 | textarea.val(initial_text); 97 | } 98 | 99 | parseAndRender(); 100 | 101 | $("#clear-text-box").click(function() { 102 | textarea.val(''); 103 | parseAndRender(); 104 | }); 105 | 106 | $("#permalink").click(function() { 107 | var smart = $("#smart").prop('checked'); 108 | window.location.pathname = "/index.html"; 109 | window.location.search = "text=" + encodeURIComponent(textarea.val()) + 110 | (smart ? '&smart=1' : ''); 111 | }); 112 | 113 | textarea.bind('input propertychange', 114 | _.debounce(parseAndRender, 50, { maxWait: 100 })); 115 | //textarea.on('scroll', _.debounce(syncScroll, 50, { maxWait: 50 })); 116 | textarea.on('scroll', syncScroll); 117 | textarea.on('keydown click focus', 118 | _.debounce(markSelection, 50, { maxWait: 100})); 119 | 120 | $("#smart").click(function() { 121 | reader.options.smart = $("#smart").prop('checked'); 122 | parseAndRender(); 123 | }); 124 | }); 125 | }); 126 | -------------------------------------------------------------------------------- /js/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, John MacFarlane 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | --- 29 | 30 | lib/normalize-reference.js is a slightly modified version of 31 | https://github.com/dmoscrop/fold-case: 32 | 33 | Copyright Mathias Bynens 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining 36 | a copy of this software and associated documentation files (the 37 | "Software"), to deal in the Software without restriction, including 38 | without limitation the rights to use, copy, modify, merge, publish, 39 | distribute, sublicense, and/or sell copies of the Software, and to 40 | permit persons to whom the Software is furnished to do so, subject to 41 | the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be 44 | included in all copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 47 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 48 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 49 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 50 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 51 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 52 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 53 | 54 | --- 55 | 56 | lib/from-code-point.js is derived from a polyfill 57 | Copyright Mathias Bynens 58 | 59 | Permission is hereby granted, free of charge, to any person obtaining 60 | a copy of this software and associated documentation files (the 61 | "Software"), to deal in the Software without restriction, including 62 | without limitation the rights to use, copy, modify, merge, publish, 63 | distribute, sublicense, and/or sell copies of the Software, and to 64 | permit persons to whom the Software is furnished to do so, subject to 65 | the following conditions: 66 | 67 | The above copyright notice and this permission notice shall be 68 | included in all copies or substantial portions of the Software. 69 | 70 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 71 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 72 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 73 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 74 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 75 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 76 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 77 | 78 | --- 79 | 80 | bench/samples/*.md: 81 | 82 | With the exception of `bench/samples/README.md`, the samples in 83 | `bench/samples` are taken from https://github.com/markdown-it/markdown-it. 84 | 85 | Copyright (c) 2014 Vitaly Puzrin, Alex Kocharin. 86 | 87 | Permission is hereby granted, free of charge, to any person 88 | obtaining a copy of this software and associated documentation 89 | files (the "Software"), to deal in the Software without 90 | restriction, including without limitation the rights to use, 91 | copy, modify, merge, publish, distribute, sublicense, and/or sell 92 | copies of the Software, and to permit persons to whom the 93 | Software is furnished to do so, subject to the following 94 | conditions: 95 | 96 | The above copyright notice and this permission notice shall be 97 | included in all copies or substantial portions of the Software. 98 | 99 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 100 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 101 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 102 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 103 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 104 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 105 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 106 | OTHER DEALINGS IN THE SOFTWARE. 107 | 108 | --- 109 | 110 | The CommonMark spec (spec.txt) in test/ is 111 | 112 | Copyright (C) 2014-15 John MacFarlane 113 | 114 | Released under the Creative Commons CC-BY-SA 4.0 license: 115 | . 116 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CommonMark Spec 6 | 72 | 73 | 74 | 75 |

    CommonMark Spec

    76 |
    77 | 78 |
    79 |
    80 | Creative
 82 |    Commons BY-SA
    CommonMark Spec by 87 | John MacFarlane is licensed under a 90 | Creative 92 | Commons Attribution-ShareAlike 4.0 International License. 93 |
    94 |
    95 | 96 |
    97 |
    98 |

    Latest version (0.26) (2016-07-15) (view changes)

    99 |

    discussion forum | interactive dingus | repository | changelog

    100 |

    Older versions:

    101 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /0.12/changes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Diff: spec.txt - spec.txt 13 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 |
     spec.txt   spec.txt 
    --- ---
    title: CommonMark Spec title: CommonMark Spec
    author: author:
    - John MacFarlane - John MacFarlane
    version: 0.11 version: 0.12
    date: 2014-11-10 date: 2014-11-10
    ... ...
    # Introduction # Introduction
    ## What is Markdown? ## What is Markdown?
    Markdown is a plain text format for writing structured documents, Markdown is a plain text format for writing structured documents,
    based on conventions used for indicating formatting in email and based on conventions used for indicating formatting in email and
    usenet posts. It was developed in 2004 by John Gruber, who wrote usenet posts. It was developed in 2004 by John Gruber, who wrote
    skipping to change at line 5088 skipping to change at line 5088
    and title are given immediately after the link text. In [reference and title are given immediately after the link text. In [reference
    links](#reference-links) the destination and title are defined elsewhere links](#reference-links) the destination and title are defined elsewhere
    in the document. in the document.
    A [link text](@link-text) consists of a sequence of zero or more A [link text](@link-text) consists of a sequence of zero or more
    inline elements enclosed by square brackets (`[` and `]`). The inline elements enclosed by square brackets (`[` and `]`). The
    following rules apply: following rules apply:
    - Links may not contain other links, at any level of nesting. - Links may not contain other links, at any level of nesting.
    - Brackets are allowed in the link text only if (a) they are - Brackets are allowed in the [link text](#link-text) only if (a) they
    backslash-escaped or (b) they appear as a matched pair of brackets, are backslash-escaped or (b) they appear as a matched pair of brackets,
    with an open bracket `[`, a sequence of zero or more inlines, and with an open bracket `[`, a sequence of zero or more inlines, and
    a close bracket `]`. a close bracket `]`.
    - Backtick [code spans](#code-span), [autolinks](#autolink), and - Backtick [code spans](#code-span), [autolinks](#autolink), and
    raw [HTML tags](#html-tag) bind more tightly raw [HTML tags](#html-tag) bind more tightly
    than the brackets in link text. Thus, for example, than the brackets in link text. Thus, for example,
    `` [foo`]` `` could not be a link text, since the second `]` `` [foo`]` `` could not be a link text, since the second `]`
    is part of a code span. is part of a code span.
    - The brackets in link text bind more tightly than markers for - The brackets in link text bind more tightly than markers for
    skipping to change at line 5851 skipping to change at line 5851
    <p>[foo]<a href="/url1">bar</a></p> <p>[foo]<a href="/url1">bar</a></p>
    . .
    ## Images ## Images
    Syntax for images is like the syntax for links, with one Syntax for images is like the syntax for links, with one
    difference. Instead of [link text](#link-text), we have an [image difference. Instead of [link text](#link-text), we have an [image
    description](@image-description). The rules for this are the description](@image-description). The rules for this are the
    same as for [link text](#link-text), except that (a) an same as for [link text](#link-text), except that (a) an
    image description starts with `![` rather than `[`, and image description starts with `![` rather than `[`, and
    (b) an image description may contain links, but not images (b) an image description may contain links.
    (even deeply nested). An image description has inline elements An image description has inline elements
    as its contents. When an image is rendered to HTML, as its contents. When an image is rendered to HTML,
    this is standardly used as the image's `alt` attribute. this is standardly used as the image's `alt` attribute.
    . .
    ![foo](/url "title") ![foo](/url "title")
    . .
    <p><img src="/url" alt="foo" title="title" /></p> <p><img src="/url" alt="foo" title="title" /></p>
    . .
    . .
    ![foo *bar*] ![foo *bar*]
    [foo *bar*]: train.jpg "train & tracks" [foo *bar*]: train.jpg "train & tracks"
    . .
    <p><img src="train.jpg" alt="foo bar" title="train &amp; tracks" /></p> <p><img src="train.jpg" alt="foo bar" title="train &amp; tracks" /></p>
    . .
    . .
    ![foo ![bar](/url)](/url2) ![foo ![bar](/url)](/url2)
    . .
    <p>![foo <img src="/url" alt="bar" />](/url2)</p> <p><img src="/url2" alt="foo bar" /></p>
    . .
    . .
    ![foo [bar](/url)](/url2) ![foo [bar](/url)](/url2)
    . .
    <p><img src="/url2" alt="foo bar" /></p> <p><img src="/url2" alt="foo bar" /></p>
    . .
    Though this spec is concerned with parsing, not rendering, it is Though this spec is concerned with parsing, not rendering, it is
    recommended that in rendering to HTML, only the plain string content recommended that in rendering to HTML, only the plain string content
     End of changes. 4 change blocks. 
    6 lines changed or deleted 6 lines changed or added

    This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/
    137 | 138 | 139 | -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | [0.26] 2 | 3 | * Empty list items can no longer interrupt a paragraph. 4 | This removes an ambiguity between setext headers and 5 | lists in cases like 6 | 7 | foo 8 | - 9 | 10 | Removed the "two blank lines breaks out of lists" rule. 11 | This is incompatible with the principle of uniformity 12 | (and indeed with the spec for list items, which requires 13 | that the meaning of a chunk of lines not change when it 14 | is put into a list item.) 15 | * Ordered list markers that interrupt a paragraph must start with 1. 16 | * Improved the section on tabs. Added some test cases for ATX 17 | headers and thematic breaks. Clarified that it's not just cases 18 | that affect indentation that matter, but all cases where whitespace 19 | matters for block structure. 20 | * Removed example of ATX header with tab after `#`. 21 | * Allow HTML blocks to end on the last line of their container 22 | (Colin O'Dell, #103). 23 | * Spec changes in strong/emph parsing. See 24 | https://talk.commonmark.org/t/emphasis-strong-emphasis-corner-cases/2123 25 | for motivation. This restores intuitive parsings for a number of cases. 26 | The main change is to disallow strong or emph when one of 27 | the delimiters is "internal" and the sum of the lengths of 28 | the enclosing delimiter runs is a multiple of 3. Thus, 29 | `**foo*bar***` gets parsed `foo*bar` rather than 30 | `foobar**` as before. Thanks to Fletcher Penney 31 | for discussion. 32 | * Add tests to check that markdown parsing is working fine after an HTML 33 | block end tag (Alexandre Mutel). 34 | * Add test case for nested lists with an indent > 4 (Alexandre Mutel). 35 | * Cleaned up terminology around lazy continuation lines. Added some links. 36 | * Fixed broken links and typos (Artyom, Matthias Geier, Sam Estep). 37 | * Use `≤` instead of `<` in list item spec for clarity. 38 | * Add point about readibility to "What is Markdown" section. 39 | * Add example for list item starting with a blank line with spaces 40 | (Robin Stocker). 41 | * Make interact more button-like and clearer (Jeff Atwood). 42 | * `spec_tests.py`: exit code is now sum of failures and errors. 43 | * `spec_tests.py`: specify newline when opening file. 44 | 45 | [0.25] 46 | 47 | * Added several more tab-handling cases (see jgm/cmark#101). 48 | * Fixed spec test for tabs. In the blockquote with a tab following 49 | the `>`, only one space should be consumed, yielding two spaces 50 | at the beginning of the content. 51 | * Update license year range to 2016 (Prayag Verma). 52 | * Fixed typo: setext heading line -> setext heading underline (#389). 53 | * Fixed date 2015->2016 (#388) 54 | 55 | [0.24] 56 | 57 | * New format for spec tests, new lua formatter for specs. 58 | The format for the spec examples has changed from 59 | 60 | . 61 | markdown 62 | . 63 | html 64 | . 65 | 66 | to 67 | 68 | ```````````````````````````````` example 69 | markdown 70 | . 71 | html 72 | ```````````````````````````````` 73 | 74 | One advantage of this is that `spec.txt` becomes a valid 75 | CommonMark file. 76 | * Change `tests/spec_test.py` to use the new format. 77 | * Replace `tools/makespec.py` with a lua script, `tools/make_spec.lua`, 78 | which uses the `lcmark` rock (and indirectly libcmark). It can 79 | generate HTML, LaTeX, and CommonMark versions of the spec. Pandoc 80 | is no longer needed for the latex/PDF version. And, since the new 81 | program uses the cmark API and operates directly on the parse tree, 82 | we get much more reliable translations than we got with the old 83 | Python script (#387). 84 | * Remove whitelist of valid schemes. Now a scheme is any sequence 85 | of 2-32 characters, beginning with an ASCII letter, and containing 86 | only ASCII letters, digits, and the symbols `-`, `+`, `.`. 87 | Discussion at . 88 | * Added an example: URI schemes must be more than one character. 89 | * Disallow spaces in link destinations, even inside pointy braces. 90 | Discussion at and 91 | . 92 | * Modify setext heading spec to allow multiline headings. 93 | Text like 94 | 95 | Foo 96 | bar 97 | --- 98 | baz 99 | 100 | is now interpreted as heading + paragraph, rather than 101 | paragraph + thematic break + paragraph. 102 | * Call U+FFFD the REPLACEMENT CHARACTER, not the "unknown code 103 | point character." 104 | * Change misleading undefined entity name example. 105 | * Remove misleading claim about entity references in raw HTML 106 | (a regression in 0.23). Entity references are not treated 107 | as literal text in raw HTML; they are just passed through. 108 | * CommonMark.dtd: allow `item` in `custom_block`. 109 | 110 | [0.23] 111 | 112 | * Don't allow space between link text and link label in a 113 | reference link. This fixes the problem of inadvertent capture: 114 | 115 | [foo] [bar] 116 | 117 | [foo]: /u1 118 | [bar]: /u2 119 | * Rename "horizontal rule" -> "thematic break". This matches the HTML5 120 | meaning for the hr element, and recognizes that the element may be 121 | rendered in various ways (not always as a horizontal rule). 122 | See http://talk.commonmark.org/t/horizontal-rule-or-thematic-break/912/3 123 | * Rename "header" -> "heading". This avoids a confusion that might arise 124 | now that HTML5 has a "header" element, distinct from the "headings" 125 | h1, h2, ... Our headings correspond to HTML5 headings, not HTML5 headers. 126 | The terminology of 'headings' is more natural, too. 127 | * ATX headers: clarify that a space (or EOL) is needed; other whitespace 128 | won't do (#373). Added a test case. 129 | * Rewrote "Entities" section with more correct terminology (#375). 130 | Entity references and numeric character references. 131 | * Clarified that spec does not dictate URL encoding/normalization policy. 132 | * New test case: list item code block with empty line (Craig M. 133 | Brandenburg). 134 | * Added example with escaped backslash at end of link label (#325). 135 | * Shortened an example so it doesn't wrap (#371). 136 | * Fixed duplicate id "attribute". 137 | * Fix four link targets (Lucas Werkmeister). 138 | * Fix typo for link to "attributes" (Robin Stocker). 139 | * Fix "delimiter" spellings and links (Sam Rawlins). 140 | * Consistent usage of "we" instead of "I" (renzo). 141 | * CommonMark.dtd - Rename `html` -> `html_block`, 142 | `inline_html` -> `html_inline` for consistency. (Otherwise it is too 143 | hard to remember whether `html` is block or inline, a source of 144 | some bugs.) 145 | * CommonMark.dtd - added `xmlns` attribute to document. 146 | * CommonMark.dtd - added `custom_block`, `custom_inline`. 147 | * CommonMark.dtd - renamed `hrule` to `thematic_break`. 148 | * Fixed some HTML inline tests, which were actually HTML blocks, given 149 | the changes to block parsing rules since these examples were written 150 | (#382). 151 | * Normalize URLs when comparing test output. This way we don't fail 152 | tests for legitimate variations in URL escaping/normalization policies 153 | (#334). 154 | * `normalize.py`: don't use `HTMLParseError`, which has been removed 155 | as of python 3.5 (#380). 156 | * Minor spacing adjustments in test output, to match cmark's output, 157 | since we test cmark without normalization. 158 | * `makespec.py`: remove need for link anchors to be on one line. 159 | * `makespec.py`: Only do two levels in the TOC. 160 | * Use `display:inline-block` rather than floats for side-by-side. 161 | This works when printed too. 162 | * Added better print CSS. 163 | 164 | [0.22] 165 | 166 | * Don't list `title` twice as HTML block tag (Robin Stocker). 167 | * More direct example of type 7 HTML block starting with closing tag. 168 | * Clarified rule 7 for HTML blocks. `pre`, `script`, and `style` 169 | are excluded because they're covered by other rules. 170 | * Clarified that type 7 HTML blocks can start with a closing tag (#349). 171 | * Removed `pre` tag from rule 6 of HTML blocks (#355). 172 | It is already covered by rule 1, so this removes an ambiguity. 173 | * Added `iframe` to list of tags that always start HTML blocks (#352). 174 | * Added example of list item starting with two blanks (#332). 175 | * Added test case clarifying laziness in block quotes (see 176 | jgm/commonmark.js#60). 177 | * Add an example with mixed indentation code block in "Tabs" section 178 | (Robin Stocker). This makes sure that implementations skip columns instead 179 | of offsets for continued indented code blocks. 180 | * Clarified that in ATX headers, the closing `#`s must be unescaped, 181 | and removed misleading reference to "non-whitespace character" in 182 | an example (#356). 183 | * Changed anchor for "non-whitespace character" to reflect new name. 184 | * Removed ambiguities concerning lines and line endings (#357, Lasse 185 | R.H. Nielsen). The previous spec allowed, technically, that a line 186 | ending in `\r\n` might be considered to have two line endings, 187 | or that the `\r` might be considered part of the line and the 188 | `\n` the line ending. These fixes rule out those interpretations. 189 | * Clarify that a character is any code point. 190 | * Space in "code point". 191 | * Capitalize "Unicode". 192 | * Reflow paragraph to avoid unwanted list item (#360, #361). 193 | * Avoid extra space before section number in `spec.md`. 194 | * `makespec.py`: Use `check_output` for simpler `pipe_through_prog`. 195 | * In README, clarified build requirements for `spec.html`, `spec.pdf`. 196 | * Fixed some encoding issues in `makespec.py` (#353). 197 | * Fixed various problems with `spec.pdf` generation (#353). 198 | * Added version to coverpage in PDF version of spec. 199 | 200 | [0.21.1] 201 | 202 | * Added date. 203 | 204 | [0.21] 205 | 206 | * Changed handling of tabs. Instead of having a preprocessing step 207 | where tabs are converted to spaces, we now handle tabs directly in 208 | the parser. This allows tabs to be retained in code blocks and code 209 | spans. This change adds some general language to the effect that, 210 | for purposes of determining block structure, tabs are to be treated 211 | just like equivalent spaces. 212 | * Completely rewrote spec for HTML blocks. The new spec provides 213 | better handling of tags like ``, which can be either block 214 | or inline level content, better handling of custom tags, and 215 | better handling of verbatim contexts like `
    `, comments,
    216 |     and `