Skip to content

Commit

Permalink
Revert "Revert "fix: move language-xx to <code> tag (as per HTML5 r…
Browse files Browse the repository at this point in the history
…ecommendation)""

This reverts commit 8e0fe3e.
  • Loading branch information
mesqueeb committed May 19, 2020
1 parent 5ae11bd commit 64806f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function parse(md, prevLinks) {
}
// Code/Indent blocks:
else if (token[3] || token[4]) {
chunk = '<pre class="code '+(token[4]?'poetry':token[2].toLowerCase())+(token[2] ? ` language-${token[2].toLowerCase()}` : '')+'"><code>'+outdent(encodeAttr(token[3] || token[4]).replace(/^\n+|\n+$/g, ''))+'</code></pre>';
chunk = '<pre class="code '+(token[4]?'poetry':token[2].toLowerCase())+'"><code'+(token[2] ? ` class="language-${token[2].toLowerCase()}"` : '')+'>'+outdent(encodeAttr(token[3] || token[4]).replace(/^\n+|\n+$/g, ''))+'</code></pre>';
}
// > Quotes, -* lists:
else if (token[6]) {
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('snarkdown()', () => {
it('parses three backtricks (```) as a code block', () => {
expect(snarkdown('```\nfunction codeBlocks() {\n\treturn "Can be inserted";\n}\n```')).to.equal('<pre class="code "><code>function codeBlocks() {\n\treturn &quot;Can be inserted&quot;;\n}</code></pre>');

expect(snarkdown('```js\nfunction codeBlocks() {\n\treturn "Can be inserted";\n}\n```')).to.equal('<pre class="code js language-js"><code>function codeBlocks() {\n\treturn &quot;Can be inserted&quot;;\n}</code></pre>');
expect(snarkdown('```js\nfunction codeBlocks() {\n\treturn "Can be inserted";\n}\n```')).to.equal('<pre class="code js"><code class="language-js">function codeBlocks() {\n\treturn &quot;Can be inserted&quot;;\n}</code></pre>');
});

it('parses tabs as a code poetry block', () => {
Expand Down

0 comments on commit 64806f1

Please sign in to comment.