From e618715636a3bd60930bea34d214b3aaf8e9e766 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 26 Oct 2014 12:37:59 -0700 Subject: Require space before closing # sequence in ATX header. Closes #169. --- js/lib/blocks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/lib/blocks.js b/js/lib/blocks.js index 109661f..175cc2a 100644 --- a/js/lib/blocks.js +++ b/js/lib/blocks.js @@ -366,7 +366,7 @@ var incorporateLine = function(ln, line_number) { container.level = match[0].trim().length; // number of #s // remove trailing ###s: container.strings = - [ln.slice(offset).replace(/(?:(\\#) *#*| *#+) *$/,'$1')]; + [ln.slice(offset).replace(/^ *#+ *$/, '').replace(/ +#+ *$/,'')]; break; } else if ((match = ln.slice(first_nonspace).match(/^`{3,}(?!.*`)|^~{3,}(?!.*~)/))) { -- cgit v1.2.3 From f22281f2d15a786d512269ddd546b5b4c0462f4c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 26 Oct 2014 20:50:01 -0700 Subject: Added clear and permalink to dingus. Serve dingus from dingus.html. Add redirect page as index.html. --- js/dingus.html | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ js/index.html | 118 +++++--------------------------------------------- 2 files changed, 145 insertions(+), 107 deletions(-) create mode 100644 js/dingus.html (limited to 'js') diff --git a/js/dingus.html b/js/dingus.html new file mode 100644 index 0000000..ecaeb33 --- /dev/null +++ b/js/dingus.html @@ -0,0 +1,134 @@ + + + + + commonmark.js demo + + + + + + + + +
+
+

commonmark.js dingus

+
+
+
+
Parsed in + ms. Rendered in ms.
+

clear 

+ +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git a/js/index.html b/js/index.html index 6f462a9..3f6c904 100644 --- a/js/index.html +++ b/js/index.html @@ -1,108 +1,12 @@ - - - - - commonmark.js demo - - - - - - - - -
    -
    -

    commonmark.js dingus

    -
    -
    -
    -
    Parsed in - ms. Rendered in ms.
    - -
      -
      -
      - -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      - + + + + CommonMark dingus + + + +

      The most recent version of the CommonMark dingus can be found +at /dingus.html/.

      + -- cgit v1.2.3 From 695b5f3705fbdb42dd7422e4dc88f25e895d1406 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 26 Oct 2014 21:17:10 -0700 Subject: Dingus improvements; moved to top level. --- js/dingus.html | 134 --------------------------------------------------------- 1 file changed, 134 deletions(-) delete mode 100644 js/dingus.html (limited to 'js') diff --git a/js/dingus.html b/js/dingus.html deleted file mode 100644 index ecaeb33..0000000 --- a/js/dingus.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - commonmark.js demo - - - - - - - - -
      -
      -

      commonmark.js dingus

      -
      -
      -
      -
      Parsed in - ms. Rendered in ms.
      -

      clear 

      - -
        -
        -
        - -
        -
        -
        -
        -
        -
        -
        -
        -
        -
        -
        -
        - - -- cgit v1.2.3 From 45ca1bc3867a48c75a6c464cf2420e25a8ef74c6 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 30 Oct 2014 22:19:12 -0700 Subject: js/lib/blocks: Made matchAt return -1 instead of null on no match. --- js/lib/blocks.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'js') diff --git a/js/lib/blocks.js b/js/lib/blocks.js index 175cc2a..791b74f 100644 --- a/js/lib/blocks.js +++ b/js/lib/blocks.js @@ -25,13 +25,13 @@ var detabLine = function(text) { }; // Attempt to match a regex in string s at offset offset. -// Return index of match or null. +// Return index of match or -1. var matchAt = function(re, s, offset) { var res = s.slice(offset).match(re); if (res) { return offset + res.index; } else { - return null; + return -1; } }; @@ -218,7 +218,7 @@ var incorporateLine = function(ln, line_number) { container = last_child; match = matchAt(/[^ ]/, ln, offset); - if (match === null) { + if (match === -1) { first_nonspace = ln.length; blank = true; } else { @@ -326,10 +326,10 @@ var incorporateLine = function(ln, line_number) { container.t != 'IndentedCode' && container.t != 'HtmlBlock' && // this is a little performance optimization: - matchAt(/^[ #`~*+_=<>0-9-]/,ln,offset) !== null) { + matchAt(/^[ #`~*+_=<>0-9-]/,ln,offset) !== -1) { match = matchAt(/[^ ]/, ln, offset); - if (match === null) { + if (match === -1) { first_nonspace = ln.length; blank = true; } else { @@ -380,7 +380,7 @@ var incorporateLine = function(ln, line_number) { offset = first_nonspace + fence_length; break; - } else if (matchAt(reHtmlBlockOpen, ln, first_nonspace) !== null) { + } else if (matchAt(reHtmlBlockOpen, ln, first_nonspace) !== -1) { // html block closeUnmatchedBlocks(this); container = this.addChild('HtmlBlock', line_number, first_nonspace); @@ -396,7 +396,7 @@ var incorporateLine = function(ln, line_number) { container.level = match[0][0] === '=' ? 1 : 2; offset = ln.length; - } else if (matchAt(reHrule, ln, first_nonspace) !== null) { + } else if (matchAt(reHrule, ln, first_nonspace) !== -1) { // hrule closeUnmatchedBlocks(this); container = this.addChild('HorizontalRule', line_number, first_nonspace); @@ -435,7 +435,7 @@ var incorporateLine = function(ln, line_number) { // appropriate container. match = matchAt(/[^ ]/, ln, offset); - if (match === null) { + if (match === -1) { first_nonspace = ln.length; blank = true; } else { -- cgit v1.2.3