codeblock = "<pre><code>" + codeblock + "\n</code></pre>";
- return hashBlock(codeblock) + nextChar;
+ return hashBlock(codeblock) ;
}
);
// attacklab: strip sentinel
text = text.replace(/~0/,"");
+
+
+ text += '~0';
+
+ text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g, function (wholeMatch, language, codeblock) {
+ var end = '\n';
+
+ // First parse the github code block
+ codeblock = _EncodeCode( codeblock);
+ codeblock = _Detab(codeblock);
+ codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
+ codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace
+
+ codeblock = '<pre><code' + (language ? ' class="' + language + ' language-' + language + '"' : '') + '>' + codeblock + end + '</code></pre>';
+
+ return hashBlock(codeblock) + nextChar;
+ });
+
+ // attacklab: strip sentinel
+ text = text.replace(/~0/, '');
+
+
+
+
+
return text;
}
text = text.replace(/^(\t|[ ]{1,4})/gm,"~0"); // attacklab: g_tab_width
// attacklab: clean up hack
- text = text.replace(/~0/g,"")
+ text = text.replace(/~0/g,"");
return text;
}