Permalink
Browse files

Maintain <code> block attributes (useCodeBlocks)

Maintain code block attributes when using the useCodeBlocks option, as this allows explicit language definition using class="language-*" classes.
  • Loading branch information...
1 parent 052fc34 commit df5a84cad9254703cf8ae908f75c4fe217324d4b @Craga89 Craga89 committed Aug 13, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/highlight.js
View
@@ -151,8 +151,8 @@ var self = this;
// JS regexpes have some multiline issues, so we temporarily remove them
return text
.replace(/\n/g,'\uffff')
- .replace(/<code>(.*?)<\/code>/gm, function(original, source){
- return '<code>'+hljs.highlightText(source.replace(/\uffff/g,"\n"), tabReplace)+'</code>';
+ .replace(/<code([^>]*)>(.*?)<\/code>/gm, function(original, attrs, source){
+ return '<code'+attrs+'>'+hljs.highlightText(source.replace(/\uffff/g,"\n"), tabReplace)+'</code>';
})
.replace(/&amp;(\w+;)/g,'&$1').replace(/\uffff/g,"\n");
} else {

0 comments on commit df5a84c

Please sign in to comment.