Merged the comment and line-comment tokens
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
diff --git a/components/prism-javascript.js b/components/prism-javascript.js
index 79ed187..f33fd11 100644
--- a/components/prism-javascript.js
+++ b/components/prism-javascript.js
@@ -1,7 +1,6 @@
Prism.languages.javascript = {
- 'comment': /\/\*[\w\W]*?\*\//g,
- 'line-comment': {
- pattern: /(^|[^\\])\/\/.*?(\r?\n|$)/g,
+ 'comment': {
+ pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,
lookbehind: true
},
'string': /("|')(\\?.)*?\1/g,
diff --git a/components/prism-javascript.min.js b/components/prism-javascript.min.js
index 1d1f569..1e6ea08 100644
--- a/components/prism-javascript.min.js
+++ b/components/prism-javascript.min.js
@@ -1 +1 @@
-Prism.languages.javascript={comment:/\/\*[\w\W]*?\*\//g,"line-comment":{pattern:/(^|[^\\])\/\/.*?(\r?\n|$)/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0},keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,number:/\b-?(0x)?\d*\.?\d+\b/g,operator:/[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\//g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,inside:{tag:{pattern:/(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});
\ No newline at end of file
+Prism.languages.javascript={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0},keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,number:/\b-?(0x)?\d*\.?\d+\b/g,operator:/[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\//g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,inside:{tag:{pattern:/(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});
\ No newline at end of file
diff --git a/extending.html b/extending.html
index d1e0ce8..f68f069 100644
--- a/extending.html
+++ b/extending.html
@@ -42,7 +42,7 @@
<dt>lookbehind</dt>
<dd>This option mitigates JavaScript’s lack of lookbehind. When set to <code>true</code>,
the first capturing group in the regex <code>pattern</code> is discarded when matching this token, so it effectively behaves
- as if it was lookbehind. For an example of this, check out the JavaScript language definition, in particular the regex and line-comment tokens:
+ as if it was lookbehind. For an example of this, check out the JavaScript language definition, in particular the regex and comment tokens:
<pre data-src="components/prism-javascript.js"></pre></dd>
<dt>rest</dt>
diff --git a/plugins/index.html b/plugins/index.html
new file mode 100644
index 0000000..9d65944
--- /dev/null
+++ b/plugins/index.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+
+<meta charset="utf-8" />
+<title>Plugins ▲ Prism</title>
+<base href=".." />
+<link rel="stylesheet" href="style.css" />
+<link rel="stylesheet" href="prism.css" data-noprefix />
+<link rel="stylesheet" href="plugins/line-highlight/prism-line-highlight.css" data-noprefix />
+<script src="../prefixfree/prefixfree.min.js"></script>
+
+</head>
+<body>
+
+<header>
+ <div class="intro" data-src="templates/header-plugins.html" data-type="text/html"></div>
+</header>
+
+<section>
+ <h1>Available plugins</h1>
+ <ul class="plugin-list"></ul>
+</section>
+
+<section>
+ <h1>Contribute</h1>
+ <p>Writing Prism plugins is easy! Read how at the “<a href="extending.html#writing-plugins">Extending Prism</a>” section.
+</section>
+
+<footer data-src="templates/footer.html" data-type="text/html"></footer>
+
+<script src="prism.js"></script>
+<script src="plugins/line-highlight/prism-line-highlight.js"></script>
+<script src="utopia.js"></script>
+<script src="code.js"></script>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/prism-dark.css b/prism-dark.css
index 7a8854d..d8869db 100644
--- a/prism-dark.css
+++ b/prism-dark.css
@@ -49,7 +49,6 @@ pre[class*="language-"] {
}
.token.comment,
-.token.line-comment,
.token.prolog,
.token.doctype,
.token.cdata {
diff --git a/prism-funky.css b/prism-funky.css
index 693d663..259c382 100644
--- a/prism-funky.css
+++ b/prism-funky.css
@@ -46,7 +46,6 @@ code[class*="language-"] {
}
.token.comment,
-.token.line-comment,
.token.prolog,
.token.doctype,
.token.cdata {
diff --git a/prism.css b/prism.css
index fb0e356..6ff9b19 100644
--- a/prism.css
+++ b/prism.css
@@ -44,7 +44,6 @@ pre[class*="language-"] {
}
.token.comment,
-.token.line-comment,
.token.prolog,
.token.doctype,
.token.cdata {
diff --git a/prism.js b/prism.js
index 74bc30f..a2e62f7 100644
--- a/prism.js
+++ b/prism.js
@@ -386,9 +386,8 @@ if (Prism.languages.markup) {
***********************************************/
Prism.languages.javascript = {
- 'comment': /\/\*[\w\W]*?\*\//g,
- 'line-comment': {
- pattern: /(^|[^\\])\/\/.*?(\r?\n|$)/g,
+ 'comment': {
+ pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,
lookbehind: true
},
'string': /("|')(\\?.)*?\1/g,