Skip to content

Commit

Permalink
Update fenced code blocks to CommonMark standard
Browse files Browse the repository at this point in the history
  • Loading branch information
Remy Rylan committed May 11, 2018
1 parent 579f7bf commit 7b1d0be
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/USING_ADVANCED.md
Expand Up @@ -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 <a href="#highlight">Asynchronous highlighting</a>.|
|langPrefix |`string` |`'lang-'`|??? |A string to prefix the className in a `<code>` block. Useful for syntax highlighting.|
|langPrefix |`string` |`'language-'`|??? |A string to prefix the className in a `<code>` 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.|
Expand Down
2 changes: 1 addition & 1 deletion lib/marked.js
Expand Up @@ -1470,7 +1470,7 @@ marked.getDefaults = function () {
headerIds: true,
headerPrefix: '',
highlight: null,
langPrefix: 'lang-',
langPrefix: 'language-',
mangle: true,
pedantic: false,
renderer: new Renderer(),
Expand Down
14 changes: 7 additions & 7 deletions test/new/gfm_code.html
@@ -1,16 +1,16 @@
<pre><code class="lang-js">var a = &#39;hello&#39;;
<pre><code class="language-js">var a = &#39;hello&#39;;
console.log(a + &#39; world&#39;);</code></pre>
<pre><code class="lang-bash">echo &quot;hello, ${WORLD}&quot;</code></pre>
<pre><code class="lang-longfence">Q: What do you call a tall person who sells stolen goods?</code></pre>
<pre><code class="lang-ManyTildes">A longfence!</code></pre>
<pre><code class="language-bash">echo &quot;hello, ${WORLD}&quot;</code></pre>
<pre><code class="language-longfence">Q: What do you call a tall person who sells stolen goods?</code></pre>
<pre><code class="language-ManyTildes">A longfence!</code></pre>
<p>How about an empty code block?</p>
<pre><code class="lang-js"></code></pre>
<pre><code class="language-js"></code></pre>
<p>How about a code block with only an empty line?</p>
<pre><code class="lang-js">
<pre><code class="language-js">
</code></pre>

<p>With some trailing empty lines:</p>
<pre><code>ciao


</code></pre>
</code></pre>
6 changes: 3 additions & 3 deletions test/new/gfm_code_hr_list.html
Expand Up @@ -22,19 +22,19 @@ <h2 id="foo">foo</h2>
<li><p>foo:</p>
<ol>
<li><p>foo <code>bar</code> bar:</p>
<pre><code class="lang-erb"> some code here
<pre><code class="language-erb"> some code here
</code></pre>
</li>
<li><p>foo <code>bar</code> bar:</p>
<pre><code class="lang-erb"> foo
<pre><code class="language-erb"> foo
---
bar
---
foo
bar</code></pre>
</li>
<li><p>foo <code>bar</code> bar:</p>
<pre><code class="lang-html"> ---
<pre><code class="language-html"> ---
foo
foo
---
Expand Down
2 changes: 1 addition & 1 deletion test/specs/commonmark/commonmark-spec.js
Expand Up @@ -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 = [];

Expand Down

0 comments on commit 7b1d0be

Please sign in to comment.