From 23b6736a60b886326c272f45588cb1447526d33a Mon Sep 17 00:00:00 2001 From: Remy Rylan Date: Fri, 11 May 2018 11:12:12 -0400 Subject: [PATCH] Update fenced code blocks to CommonMark standard --- docs/USING_ADVANCED.md | 2 +- lib/marked.js | 2 +- test/new/gfm_code.html | 14 +++++++------- test/new/gfm_code_hr_list.html | 6 +++--- test/specs/commonmark/commonmark-spec.js | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/USING_ADVANCED.md b/docs/USING_ADVANCED.md index df76a5018c..500eacc533 100644 --- a/docs/USING_ADVANCED.md +++ b/docs/USING_ADVANCED.md @@ -47,7 +47,7 @@ console.log(myMarked('I am using __markdown__.')); |headerIds |`boolean` |`true` |v0.4.0 |If true, include an `id` attribute when emitting headings (h1, h2, h3, etc).| |headerPrefix|`string` |`''` |??? |A string to prefix the `id` attribute when emitting headings (h1, h2, h3, etc).| |highlight |`function`|`null` |??? |A function to highlight code blocks, see Asynchronous highlighting.| -|langPrefix |`string` |`'lang-'`|??? |A string to prefix the className in a `` block. Useful for syntax highlighting.| +|langPrefix |`string` |`'language-'`|??? |A string to prefix the className in a `` block. Useful for syntax highlighting.| |mangle |`boolean` |`true` |??? |??? | |pedantic |`boolean` |`false` |??? |If true, conform to the original `markdown.pl` as much as possible. Don't fix original markdown bugs or behavior. Turns off and overrides `gfm`.| |renderer |`object` |`new Renderer()`|???|An object containing functions to render tokens to HTML. See [extensibility](USING_PRO.md) for more details.| diff --git a/lib/marked.js b/lib/marked.js index 83974865e4..cd02d7afbc 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -1470,7 +1470,7 @@ marked.getDefaults = function () { headerIds: true, headerPrefix: '', highlight: null, - langPrefix: 'lang-', + langPrefix: 'language-', mangle: true, pedantic: false, renderer: new Renderer(), diff --git a/test/new/gfm_code.html b/test/new/gfm_code.html index 438acdf8eb..0e8c693196 100644 --- a/test/new/gfm_code.html +++ b/test/new/gfm_code.html @@ -1,16 +1,16 @@ -
var a = 'hello';
+
var a = 'hello';
 console.log(a + ' world');
-
echo "hello, ${WORLD}"
-
Q: What do you call a tall person who sells stolen goods?
-
A longfence!
+
echo "hello, ${WORLD}"
+
Q: What do you call a tall person who sells stolen goods?
+
A longfence!

How about an empty code block?

-
+

How about a code block with only an empty line?

-

+

 

With some trailing empty lines:

ciao
 
 
-
\ No newline at end of file +
diff --git a/test/new/gfm_code_hr_list.html b/test/new/gfm_code_hr_list.html index 9fbd0fb9dd..d15b52fe02 100644 --- a/test/new/gfm_code_hr_list.html +++ b/test/new/gfm_code_hr_list.html @@ -22,11 +22,11 @@

foo

  • foo:

    1. foo bar bar:

      -
       some code here
      +
       some code here
       
    2. foo bar bar:

      -
       foo
      +
       foo
        ---
        bar
        ---
      @@ -34,7 +34,7 @@ 

      foo

      bar
    3. foo bar bar:

      -
       ---
      +
       ---
        foo
        foo
        ---
      diff --git a/test/specs/commonmark/commonmark-spec.js b/test/specs/commonmark/commonmark-spec.js
      index 280824f1c0..4205044586 100644
      --- a/test/specs/commonmark/commonmark-spec.js
      +++ b/test/specs/commonmark/commonmark-spec.js
      @@ -155,7 +155,7 @@ describe('CommonMark 0.28 Fenced code blocks', function() {
         var section = 'Fenced code blocks';
       
         // var shouldPassButFails = [];
      -  var shouldPassButFails = [93, 95, 96, 97, 101, 102, 106, 108, 111, 112, 113];
      +  var shouldPassButFails = [93, 95, 96, 97, 101, 102, 106, 108, 112];
       
         var willNotBeAttemptedByCoreTeam = [];