Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit 858ac80

Browse files
author
mikesamuel@gmail.com
committed
Fix some problematic regexps that mucked up extracting of embedded HTML tags in prettified text. Specifically, H1 and friends would not work, and CDATA sections in XHTML would be mangled.
1 parent bb9db83 commit 858ac80

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/prettify.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,13 +611,14 @@ window['_pr_isIE6'] = function () {
611611
'[^<]+' // A run of characters other than '<'
612612
+ '|<\!--[\\s\\S]*?--\>' // an HTML comment
613613
+ '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>' // a CDATA section
614-
+ '|</?[a-zA-Z][^>]*>' // a probable tag that should not be highlighted
614+
// a probable tag that should not be highlighted
615+
+ '|<\/?[a-zA-Z](?:[^>\"\']|\'[^\']*\'|\"[^\"]*\")*>'
615616
+ '|<', // A '<' that does not begin a larger chunk
616617
'g');
617618
var pr_commentPrefix = /^<\!--/;
618-
var pr_cdataPrefix = /^<\[CDATA\[/;
619+
var pr_cdataPrefix = /^<!\[CDATA\[/;
619620
var pr_brPrefix = /^<br\b/i;
620-
var pr_tagNameRe = /^<(\/?)([a-zA-Z]+)/;
621+
var pr_tagNameRe = /^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/;
621622

622623
/** split markup into chunks of html tags (style null) and
623624
* plain text (style {@link #PR_PLAIN}), converting tags which are

0 commit comments

Comments
 (0)