Renamed html to markup, since it’s also about XML
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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
diff --git a/components/prism-html.js b/components/prism-html.js
deleted file mode 100644
index a4cf8eb..0000000
--- a/components/prism-html.js
+++ /dev/null
@@ -1,64 +0,0 @@
-Prism.languages.html = {
- 'comment': /<!--[\w\W]*?--(>|>)/g,
- 'script': null,
- 'style': null,
- 'tag': {
- pattern: /(<|<)\/?[\w\W]+?(>|>)/gi,
- inside: {
- 'tag': {
- pattern: /^(<|<)\/?[\w:-]+/i,
- inside: {
- 'punctuation': /^(<|<)\/?/,
- 'namespace': /^[\w-]+?:/
- }
- },
- 'attr-value': {
- pattern: /=(('|").*?(\2)|[^\s>]+)/gi,
- inside: {
- 'punctuation': /=/g
- }
- },
- 'punctuation': /\/?>|\/?>/g,
- 'attr-name': {
- pattern: /[\w:-]+/g,
- inside: {
- 'namespace': /^[\w-]+?:/
- }
- }
-
- }
- },
- 'entity': /&#?[\da-z]{1,8};/gi
-};
-
-if (Prism.languages.javascript) {
- Prism.languages.html.script = {
- pattern: /(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,
- inside: {
- 'tag': {
- pattern: /(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,
- inside: Prism.languages.html.tag.inside
- },
- rest: Prism.languages.javascript
- }
- };
-}
-else {
- delete Prism.languages.html.script;
-}
-
-if (Prism.languages.css) {
- Prism.languages.html.style = {
- pattern: /(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,
- inside: {
- 'tag': {
- pattern: /(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,
- inside: Prism.languages.html.tag.inside
- },
- rest: Prism.languages.css
- }
- };
-}
-else {
- delete Prism.languages.html.style;
-}
\ No newline at end of file
diff --git a/components/prism-markup.js b/components/prism-markup.js
new file mode 100644
index 0000000..79aa4d2
--- /dev/null
+++ b/components/prism-markup.js
@@ -0,0 +1,64 @@
+Prism.languages.markup = {
+ 'comment': /<!--[\w\W]*?--(>|>)/g,
+ 'script': null,
+ 'style': null,
+ 'tag': {
+ pattern: /(<|<)\/?[\w\W]+?(>|>)/gi,
+ inside: {
+ 'tag': {
+ pattern: /^(<|<)\/?[\w:-]+/i,
+ inside: {
+ 'punctuation': /^(<|<)\/?/,
+ 'namespace': /^[\w-]+?:/
+ }
+ },
+ 'attr-value': {
+ pattern: /=(('|").*?(\2)|[^\s>]+)/gi,
+ inside: {
+ 'punctuation': /=/g
+ }
+ },
+ 'punctuation': /\/?>|\/?>/g,
+ 'attr-name': {
+ pattern: /[\w:-]+/g,
+ inside: {
+ 'namespace': /^[\w-]+?:/
+ }
+ }
+
+ }
+ },
+ 'entity': /&#?[\da-z]{1,8};/gi
+};
+
+if (Prism.languages.javascript) {
+ Prism.languages.markup.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
+ }
+ };
+}
+else {
+ delete Prism.languages.markup.script;
+}
+
+if (Prism.languages.css) {
+ Prism.languages.markup.style = {
+ pattern: /(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,
+ inside: {
+ 'tag': {
+ pattern: /(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,
+ inside: Prism.languages.markup.tag.inside
+ },
+ rest: Prism.languages.css
+ }
+ };
+}
+else {
+ delete Prism.languages.markup.style;
+}
\ No newline at end of file
diff --git a/examples.html b/examples.html
index 2701fc4..f85d5f3 100644
--- a/examples.html
+++ b/examples.html
@@ -26,23 +26,23 @@
</div></header>
<section>
- <h1>HTML/XML</h1>
+ <h1>Markup</h1>
<h2>Empty tag</h2>
- <pre class="prism"><code class="language-html"><p></p></code></pre>
+ <pre class="prism"><code class="language-markup"><p></p></code></pre>
<h2>Name-attribute pair</h2>
- <pre class="prism"><code class="language-html"><p class="prism"></p></code></pre>
+ <pre class="prism"><code class="language-markup"><p class="prism"></p></code></pre>
<h2>Name-attribute pair without quotes</h2>
- <pre class="prism"><code class="language-html"><p class=prism></p></code></pre>
+ <pre class="prism"><code class="language-markup"><p class=prism></p></code></pre>
<h2>Attribute without value</h2>
- <pre class="prism"><code class="language-html"><p data-foo></p></code></pre>
- <pre class="prism"><code class="language-html"><p data-foo ></p></code></pre>
+ <pre class="prism"><code class="language-markup"><p data-foo></p></code></pre>
+ <pre class="prism"><code class="language-markup"><p data-foo ></p></code></pre>
<h2>Namespaces</h2>
- <pre class="prism"><code class="language-html"><html:p foo:bar="baz" foo:weee></html:p></code></pre>
+ <pre class="prism"><code class="language-markup"><html:p foo:bar="baz" foo:weee></html:p></code></pre>
</pre>
</section>
diff --git a/index.html b/index.html
index 18f0d13..743898a 100644
--- a/index.html
+++ b/index.html
@@ -70,20 +70,20 @@
<iframe src="style.css"></iframe>
<p>And this page’s innerHTML, highlighted with Prism:</p>
- <pre id="innerHTML" class="prism"><code class="language-html"></code></pre>
+ <pre id="innerHTML" class="prism"><code class="language-markup"></code></pre>
</section>
<section id="how-to-use">
<h1>How to use</h1>
<p>You will need to include the <code>prism.css</code> and <code>prism.js</code> files you downloaded in your page. Include the CSS file by putting this code on your <code><head></code> element:
- <pre class="prism"><code class="language-html"><link href="prism.css" rel="stylesheet" /></code></pre>
+ <pre class="prism"><code class="language-markup"><link href="prism.css" rel="stylesheet" /></code></pre>
<p>To include the JavaScript file add this code somewhere in your HTML document, preferably at the bottom, right before the closing <code></body></code> tag:
- <pre class="prism"><code class="language-html"><script src="prism.js"></script></code></pre>
+ <pre class="prism"><code class="language-markup"><script src="prism.js"></script></code></pre>
<p>Then, you need to add two CSS classes to any element you want to be automatically processed by Prism: <code>prism</code> and <code>language-xxxx</code> where <code>xxxx</code> is the language of the code. For example:
- <pre class="prism"><code class="language-html"><code class="prism language-css">* { margin: 0; }</code></code></pre>
+ <pre class="prism"><code class="language-markup"><code class="prism language-css">* { margin: 0; }</code></code></pre>
<p>If you are following the recommended way of presenting code blocks and using a <code><pre></code> with a <code><code></code> inside it, it’s recommended that you apply the <code>.prism</code> class to the <code><pre></code>.
The class name <code>language-xxxx</code> is actually the W3C recommended way to <a href="http://www.w3.org/TR/html5/the-code-element.html#the-code-element">declare code languages</a>.</p>
diff --git a/prism.js b/prism.js
index 9deba58..1d18a83 100644
--- a/prism.js
+++ b/prism.js
@@ -214,10 +214,10 @@ Prism.languages.javascript = {
};
/***********************************************
- Begin prism-html.js
+ Begin prism-markup.js
***********************************************/
-Prism.languages.html = {
+Prism.languages.markup = {
'comment': /<!--[\w\W]*?--(>|>)/g,
'script': null,
'style': null,
@@ -251,33 +251,33 @@ Prism.languages.html = {
};
if (Prism.languages.javascript) {
- Prism.languages.html.script = {
+ Prism.languages.markup.script = {
pattern: /(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,
inside: {
'tag': {
pattern: /(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,
- inside: Prism.languages.html.tag.inside
+ inside: Prism.languages.markup.tag.inside
},
rest: Prism.languages.javascript
}
};
}
else {
- delete Prism.languages.html.script;
+ delete Prism.languages.markup.script;
}
if (Prism.languages.css) {
- Prism.languages.html.style = {
+ Prism.languages.markup.style = {
pattern: /(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,
inside: {
'tag': {
pattern: /(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,
- inside: Prism.languages.html.tag.inside
+ inside: Prism.languages.markup.tag.inside
},
rest: Prism.languages.css
}
};
}
else {
- delete Prism.languages.html.style;
+ delete Prism.languages.markup.style;
}
\ No newline at end of file