diff --git a/lib/render/html.js b/lib/render/html.js index 2963deae..4dc2fb58 100644 --- a/lib/render/html.js +++ b/lib/render/html.js @@ -144,7 +144,11 @@ function code_block(node) { var info_words = node.info ? node.info.split(/\s+/) : [], attrs = this.attrs(node); if (info_words.length > 0 && info_words[0].length > 0) { - attrs.push(["class", "language-" + this.esc(info_words[0])]); + var cls = this.esc(info_words[0]); + if (!/^language-/.exec(cls)) { + cls = "language-" + cls; + } + attrs.push(["class", cls]); } this.cr(); this.tag("pre"); diff --git a/test/regression.txt b/test/regression.txt index 98e98f11..48ba72a3 100644 --- a/test/regression.txt +++ b/test/regression.txt @@ -455,3 +455,19 @@ _*xx-_-
*__--
*xx--
```````````````````````````````` + +#277: +```````````````````````````````` example +```language-r +x <- 1 +``` + +```r +x <- 1 +``` +. +x <- 1
+
+x <- 1
+
+````````````````````````````````