Renamed html to markup, since it’s also about XML
This commit is contained in:
parent
6e9c4e1b65
commit
6dc08f3d61
|
@ -1,4 +1,4 @@
|
|||
Prism.languages.html = {
|
||||
Prism.languages.markup = {
|
||||
'comment': /<!--[\w\W]*?--(>|>)/g,
|
||||
'script': null,
|
||||
'style': null,
|
||||
|
@ -32,33 +32,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;
|
||||
}
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
16
prism.js
16
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;
|
||||
}
|
Loading…
Reference in New Issue