prism/docs/global.html

965 lines
14 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Global - Documentation</title>
<meta property="og:title" content="Prism generated API documentation"/>
<meta property="og:type" content="website"/>
<meta property="og:image" content="/logo.svg"/>
<meta property="og:site_name" content="Prism"/>
<meta property="og:url" content="https://prismjs.com"/>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="/favicon.png"/>
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<input type="text" id="nav-search" placeholder="Search" />
<h2><a href="index.html">Home</a></h2><h2><a href="https://prismjs.com" class="menu-item" id="website_link" >PrismJS</a></h2><h2><a href="https://github.com/PrismJS/prism" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="Token.html">Token</a></li></ul><h3>Namespaces</h3><ul><li><a href="Prism.html">Prism</a><ul class='members'><li data-type='member'><a href="Prism.html#.manual">manual</a></li></ul><ul class='methods'><li data-type='method'><a href="Prism.html#.highlight">highlight</a></li><li data-type='method'><a href="Prism.html#.highlightAll">highlightAll</a></li><li data-type='method'><a href="Prism.html#.highlightAllUnder">highlightAllUnder</a></li><li data-type='method'><a href="Prism.html#.highlightElement">highlightElement</a></li><li data-type='method'><a href="Prism.html#.tokenize">tokenize</a></li></ul></li><li><a href="Prism.hooks.html">hooks</a><ul class='methods'><li data-type='method'><a href="Prism.hooks.html#.add">add</a></li><li data-type='method'><a href="Prism.hooks.html#.run">run</a></li></ul></li><li><a href="Prism.languages.html">languages</a><ul class='methods'><li data-type='method'><a href="Prism.languages.html#.extend">extend</a></li><li data-type='method'><a href="Prism.languages.html#.insertBefore">insertBefore</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Grammar">Grammar</a></li><li><a href="global.html#GrammarToken">GrammarToken</a></li><li><a href="global.html#HighlightCallback">HighlightCallback</a></li><li><a href="global.html#HookCallback">HookCallback</a></li><li><a href="global.html#TokenStream">TokenStream</a></li></ul>
</nav>
<div id="main">
<h1 class="page-title">Global</h1>
<section>
<header>
<h2>
</h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id="Grammar">Grammar</h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1146">line 1146</a>
</li></ul></dd>
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>rest</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Grammar">Grammar</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>An optional grammar object that will be appended to this grammar.</p></td>
</tr>
</tbody>
</table>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object.&lt;string, (RegExp|<a href="global.html#GrammarToken">GrammarToken</a>|Array.&lt;(RegExp|<a href="global.html#GrammarToken">GrammarToken</a>)>)></span>
</li>
</ul>
<h4 class="name" id="GrammarToken">GrammarToken</h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1125">line 1125</a>
</li></ul></dd>
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>pattern</code></td>
<td class="type">
<span class="param-type">RegExp</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The regular expression of the token.</p></td>
</tr>
<tr>
<td class="name"><code>lookbehind</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
<code>false</code>
</td>
<td class="description last"><p>If <code>true</code>, then the first capturing group of <code>pattern</code> will (effectively)
behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.</p></td>
</tr>
<tr>
<td class="name"><code>greedy</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
<code>false</code>
</td>
<td class="description last"><p>Whether the token is greedy.</p></td>
</tr>
<tr>
<td class="name"><code>alias</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Array.&lt;string></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>An optional alias or list of aliases.</p></td>
</tr>
<tr>
<td class="name"><code>inside</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Grammar">Grammar</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The nested grammar of this token.</p>
<p>The <code>inside</code> grammar will be used to tokenize the text value of each token of this kind.</p>
<p>This can be used to make nested and even recursive language definitions.</p>
<p>Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
each another.</p></td>
</tr>
</tbody>
</table>
<div class="description usertext">
<p>The expansion of a simple <code>RegExp</code> literal to support additional properties.</p>
</div>
<h4 class="name" id="HighlightCallback"><span class="type-signature"></span>HighlightCallback<span class="signature">(element)</span><span class="type-signature"> &rarr; {void}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1154">line 1154</a>
</li></ul></dd>
</dl>
<div class="description usertext">
<p>A function which will invoked after an element was successfully highlighted.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>element</code></td>
<td class="type">
<span class="param-type">Element</span>
</td>
<td class="description last"><p>The element successfully highlighted.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">void</span>
</dd>
</dl>
<h4 class="name" id="HookCallback"><span class="type-signature"></span>HookCallback<span class="signature">(env)</span><span class="type-signature"> &rarr; {void}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1164">line 1164</a>
</li></ul></dd>
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>env</code></td>
<td class="type">
<span class="param-type">Object.&lt;string, any></span>
</td>
<td class="description last"><p>The environment variables of the hook.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">void</span>
</dd>
</dl>
<h4 class="name" id="TokenStream">TokenStream</h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line755">line 755</a>
</li></ul></dd>
</dl>
<div class="description usertext">
<p>A token stream is an array of strings and <a href="Token.html"><code>Token</code></a> objects.</p>
<p>Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
them.</p>
<ol>
<li>
<p>No adjacent strings.</p>
</li>
<li>
<p>No empty strings.</p>
<p>The only exception here is the token stream that only contains the empty string and nothing else.</p>
</li>
</ol>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Array.&lt;(string|<a href="Token.html">Token</a>)></span>
</li>
</ul>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.4</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/search.js" defer></script>
<link type="text/css" rel="stylesheet" href="styles/overwrites.css">
</body>
</html>