Renamed html to markup, since it’s also about XML

This commit is contained in:
Lea Verou 2012-07-12 17:18:48 +03:00
parent 6e9c4e1b65
commit 6dc08f3d61
4 changed files with 26 additions and 26 deletions

View File

@ -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: /(&lt;|<)script[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/script(>|&gt;)/ig,
inside: {
'tag': {
pattern: /(&lt;|<)script[\w\W]*?(>|&gt;)|(&lt;|<)\/script(>|&gt;)/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: /(&lt;|<)style[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/style(>|&gt;)/ig,
inside: {
'tag': {
pattern: /(&lt;|<)style[\w\W]*?(>|&gt;)|(&lt;|<)\/style(>|&gt;)/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;
}

View File

@ -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">&lt;p>&lt;/p></code></pre>
<pre class="prism"><code class="language-markup">&lt;p>&lt;/p></code></pre>
<h2>Name-attribute pair</h2>
<pre class="prism"><code class="language-html">&lt;p class="prism">&lt;/p></code></pre>
<pre class="prism"><code class="language-markup">&lt;p class="prism">&lt;/p></code></pre>
<h2>Name-attribute pair without quotes</h2>
<pre class="prism"><code class="language-html">&lt;p class=prism>&lt;/p></code></pre>
<pre class="prism"><code class="language-markup">&lt;p class=prism>&lt;/p></code></pre>
<h2>Attribute without value</h2>
<pre class="prism"><code class="language-html">&lt;p data-foo>&lt;/p></code></pre>
<pre class="prism"><code class="language-html">&lt;p data-foo >&lt;/p></code></pre>
<pre class="prism"><code class="language-markup">&lt;p data-foo>&lt;/p></code></pre>
<pre class="prism"><code class="language-markup">&lt;p data-foo >&lt;/p></code></pre>
<h2>Namespaces</h2>
<pre class="prism"><code class="language-html">&lt;html:p foo:bar="baz" foo:weee>&lt;/html:p></code></pre>
<pre class="prism"><code class="language-markup">&lt;html:p foo:bar="baz" foo:weee>&lt;/html:p></code></pre>
</pre>
</section>

View File

@ -70,20 +70,20 @@
<iframe src="style.css"></iframe>
<p>And this pages 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>&lt;head></code> element:
<pre class="prism"><code class="language-html">&lt;link href="prism.css" rel="stylesheet" /></code></pre>
<pre class="prism"><code class="language-markup">&lt;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>&lt;/body></code> tag:
<pre class="prism"><code class="language-html">&lt;script src="prism.js">&lt;/script></code></pre>
<pre class="prism"><code class="language-markup">&lt;script src="prism.js">&lt;/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">&lt;code class="prism language-css">* { margin: 0; }&lt;/code></code></pre>
<pre class="prism"><code class="language-markup">&lt;code class="prism language-css">* { margin: 0; }&lt;/code></code></pre>
<p>If you are following the recommended way of presenting code blocks and using a <code>&lt;pre></code> with a <code>&lt;code></code> inside it, its recommended that you apply the <code>.prism</code> class to the <code>&lt;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>

View File

@ -214,10 +214,10 @@ Prism.languages.javascript = {
};
/***********************************************
Begin prism-html.js
Begin prism-markup.js
***********************************************/
Prism.languages.html = {
Prism.languages.markup = {
'comment': /&lt;!--[\w\W]*?--(>|&gt;)/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: /(&lt;|<)script[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/script(>|&gt;)/ig,
inside: {
'tag': {
pattern: /(&lt;|<)script[\w\W]*?(>|&gt;)|(&lt;|<)\/script(>|&gt;)/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: /(&lt;|<)style[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/style(>|&gt;)/ig,
inside: {
'tag': {
pattern: /(&lt;|<)style[\w\W]*?(>|&gt;)|(&lt;|<)\/style(>|&gt;)/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;
}