Commit 6c2d8f35 authored by Douwe Maan's avatar Douwe Maan

Statisfy eslint

parent 21755ac9
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/*= require lib/utils/common_utils */ /*= require lib/utils/common_utils */
(() => { (() => {
const gfmRules = { const gfmRules = {
// The filters referenced in lib/banzai/pipeline/gfm_pipeline.rb convert // The filters referenced in lib/banzai/pipeline/gfm_pipeline.rb convert
...@@ -96,11 +95,11 @@ ...@@ -96,11 +95,11 @@
let lines = text.trim().split('\n'); let lines = text.trim().split('\n');
// Add two spaces to the front of subsequent list items lines, // Add two spaces to the front of subsequent list items lines,
// or leave the line entirely blank. // or leave the line entirely blank.
lines = lines.map((s) => { lines = lines.map((l) => {
s = s.trim(); const line = l.trim();
if (s.length === 0) return ''; if (line.length === 0) return '';
return ` ${s}`; return ` ${line}`;
}); });
return `<dl>\n${lines.join('\n')}\n</dl>`; return `<dl>\n${lines.join('\n')}\n</dl>`;
...@@ -111,20 +110,21 @@ ...@@ -111,20 +110,21 @@
}, },
}, },
SyntaxHighlightFilter: { SyntaxHighlightFilter: {
'pre.code.highlight'(el, text) { 'pre.code.highlight'(el, t) {
const text = t.trim();
let lang = el.getAttribute('lang'); let lang = el.getAttribute('lang');
if (lang === 'plaintext') { if (lang === 'plaintext') {
lang = ''; lang = '';
} }
text = text.trim();
// Prefixes lines with 4 spaces if the code contains triple backticks // Prefixes lines with 4 spaces if the code contains triple backticks
if (lang === '' && text.match(/^```/gm)) { if (lang === '' && text.match(/^```/gm)) {
return text.split('\n').map((s) => { return text.split('\n').map((l) => {
s = s.trim(); const line = l.trim();
if (s.length === 0) return ''; if (line.length === 0) return '';
return ` ${s}`; return ` ${line}`;
}).join('\n'); }).join('\n');
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment