ethers.js/docs/v5/documentation/index.html
2021-02-08 15:26:10 -05:00

300 lines
30 KiB
HTML

<!DOCTYPE html>
<html class="paged">
<head>
<title>Flatworm Docs</title>
<link rel="stylesheet" type="text/css" href="/v5/static/style.css">
<meta property="og:title" content="Flatworm Docs"/>
<meta property="og:description" content="Documentation for ethers, a complete, tiny and simple Ethereum library."/>
<meta property="og:image" content="/v5/static/social.jpg"/>
</head>
<body>
<div class="sidebar">
<div class="header">
<div class="logo"><a href="/v5/"><div class="image"></div><div class="name">ethers</div><div class="version">v5.0</div></a></div>
<div class="search"><form action="/v5/search/" method="GET"><input name="search" id="search" /></form><span class="search-icon">&#9906;</span></div>
</div>
<div class="toc"><div>
<div class="link title"><a href="/v5/">Documentation</a></div><div class="base show link depth-1"><a href="/v5/getting-started/">Getting Started</a></div><div class="base show link depth-1"><a href="/v5/concepts/">Ethereum Basics</a></div><div class="hide link depth-2"><a href="/v5/concepts/events/">Events</a></div><div class="hide link depth-2"><a href="/v5/concepts/gas/">Gas</a></div><div class="hide link depth-2"><a href="/v5/concepts/security/">Security</a></div><div class="hide link depth-2"><a href="/v5/concepts/best-practices/">Best Practices</a></div><div class="base show link depth-1"><a href="/v5/api-keys/">Provider API Keys</a></div><div class="base show link depth-1"><a href="/v5/api/">Application Programming Interface</a></div><div class="hide link depth-2"><a href="/v5/api/providers/">Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/provider/">Provider</a></div><div class="hide link depth-3"><a href="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></div><div class="hide link depth-3"><a href="/v5/api/providers/api-providers/">API Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/other/">Other Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/types/">Types</a></div><div class="hide link depth-2"><a href="/v5/api/signer/">Signers</a></div><div class="hide link depth-2"><a href="/v5/api/contract/">Contract Interaction</a></div><div class="hide link depth-3"><a href="/v5/api/contract/contract/">Contract</a></div><div class="hide link depth-3"><a href="/v5/api/contract/contract-factory/">ContractFactory</a></div><div class="hide link depth-3"><a href="/v5/api/contract/example/">Example: ERC-20 Contract</a></div><div class="hide link depth-2"><a href="/v5/api/utils/">Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/abi/">Application Binary Interface</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/coder/">AbiCoder</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/formats/">ABI Formats</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/fragments/">Fragments</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/interface/">Interface</a></div><div class="hide link depth-3"><a href="/v5/api/utils/address/">Addresses</a></div><div class="hide link depth-3"><a href="/v5/api/utils/bignumber/">BigNumber</a></div><div class="hide link depth-3"><a href="/v5/api/utils/bytes/">Byte Manipulation</a></div><div class="hide link depth-3"><a href="/v5/api/utils/constants/">Constants</a></div><div class="hide link depth-3"><a href="/v5/api/utils/display-logic/">Display Logic and Input</a></div><div class="hide link depth-3"><a href="/v5/api/utils/encoding/">Encoding Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/fixednumber/">FixedNumber</a></div><div class="hide link depth-3"><a href="/v5/api/utils/hashing/">Hashing Algorithms</a></div><div class="hide link depth-3"><a href="/v5/api/utils/hdnode/">HD Wallet</a></div><div class="hide link depth-3"><a href="/v5/api/utils/logger/">Logging</a></div><div class="hide link depth-3"><a href="/v5/api/utils/properties/">Property Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/signing-key/">Signing Key</a></div><div class="hide link depth-3"><a href="/v5/api/utils/strings/">Strings</a></div><div class="hide link depth-3"><a href="/v5/api/utils/transactions/">Transactions</a></div><div class="hide link depth-3"><a href="/v5/api/utils/web/">Web Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/wordlists/">Wordlists</a></div><div class="hide link depth-2"><a href="/v5/api/other/">Other Libraries</a></div><div class="hide link depth-3"><a href="/v5/api/other/assembly/">Assembly</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/dialect/">Ethers ASM Dialect</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/api/">Utilities</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/ast/">Abstract Syntax Tree</a></div><div class="hide link depth-3"><a href="/v5/api/other/hardware/">Hardware Wallets</a></div><div class="hide link depth-2"><a href="/v5/api/experimental/">Experimental</a></div><div class="base show link depth-1"><a href="/v5/cli/">Command Line Interfaces</a></div><div class="hide link depth-2"><a href="/v5/cli/ethers/">Sandbox Utility</a></div><div class="hide link depth-2"><a href="/v5/cli/asm/">Assembler</a></div><div class="hide link depth-2"><a href="/v5/cli/ens/">Ethereum Naming Service</a></div><div class="hide link depth-2"><a href="/v5/cli/typescript/">TypeScript</a></div><div class="hide link depth-2"><a href="/v5/cli/plugin/">Making Your Own</a></div><div class="base show link depth-1"><a href="/v5/cookbook/">Cookbook</a></div><div class="hide link depth-2"><a href="/v5/cookbook/react-native/">React Native (and ilk)</a></div><div class="base show link depth-1"><a href="/v5/migration/">Migration Guide</a></div><div class="hide link depth-2"><a href="/v5/migration/web3/">Migration: From Web3.js</a></div><div class="hide link depth-2"><a href="/v5/migration/ethers-v4/">Migration: From Ethers v4</a></div><div class="base show link depth-1"><a href="/v5/testing/">Testing</a></div><div class="base show link depth-1"><a href="/v5/contributing/">Contributing and Hacking</a></div><div class="base show link depth-1"><a href="/v5/other-resources/">Other Resources</a></div><div class="base myself ancestor ancestor show link depth-1"><a href="/v5/documentation/">Flatworm Docs</a></div><div class="link show child depth-2"><a href="#flatworm-fragments">Fragments</a></div><div class="link show child depth-2"><a href="#flatworm-markdown">Markdown</a></div><div class="link show child depth-2"><a href="#flatworm--code">Code</a></div><div class="link show child depth-2"><a href="#flatworm--table">Tables</a></div><div class="link show child depth-2"><a href="#flatworm-config">Configuration</a></div><div class="link show child depth-2"><a href="#flatworm-extensions">Extensions</a></div><div class="base show link depth-1"><a href="/v5/license/">License and Copyright</a></div>
</div></div>
<div class="footer">
<a href="/v5/single-page/">Single Page</a>
</div>
</div>
<div class="content">
<div class="breadcrumbs"><a href="/v5/">Documentation</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<span class="current">Flatworm Docs</span></div>
<a name="flatworm"></a><a name="flatworm"></a><h1 class="show-anchors"><div>Flatworm Docs<div class="anchors"><a class="self" href="/v5/documentation/#flatworm"></a></div></div></h1><p>The <i>Flatworm Docs</i> rendering engine is designed to be <b>very</b> simple, but provide enough formatting necessary for documenting JavaScript libraries.</p>
<p>A lot of its inspiration came from <a href="https://github.com/readthedocs/sphinx_rtd_theme">Read the Docs</a> and the <a href="https://www.sphinx-doc.org/">Sphinx</a> project.</p>
<a name="flatworm-fragments"></a><a name="flatworm--flatworm-fragments"></a><h2 class="show-anchors"><div>Fragments<div class="anchors"><a class="self" href="/v5/documentation/#flatworm-fragments"></a></div></div></h2><p>Each page is made up of fragments. A fragment is a <a href="/v5/documentation/#flatworm-directive">directive</a>, with an value and optional <i>link</i>, <i>extensions</i> and a body.</p>
<p>Many directives support <a href="/v5/documentation/#flatworm-markdown">markdown</a> in their value and body.</p>
<p>A fragment's body continues until another fragment is encountered.</p>
<a name="flatworm--flatworm-fragments--directive-format"></a><h3 class="show-anchors"><div>Directive Format<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--flatworm-fragments--directive-format"></a></div></div></h3>
<div class="code">_DIRECTIVE: VALUE @&lt;LINK&gt; @EXTENSION&lt;PARAMETER&gt;
BODY
MORE BODY
DIRECTIVE: The directive name
VALUE: Optional; the value to pass to the directive
LINK: Optional; a name for internal linking
EXTENSION: Optional; extended directive functionality
PARAMETER: Optional; value to pass to extended directive functions
BODY: Optional; the directive body (certain directives only)</div><a name="flatworm-directive"></a><a name="flatworm--flatworm-fragments--flatworm-directive"></a><h3 class="show-anchors"><div>Flatworm Directives<div class="anchors"><a class="self" href="/v5/documentation/#flatworm-directive"></a></div></div></h3>
<div class="definition"><div class="term"><b>_section:</b> <i>TITLE</i></div><div class="body"><p>A <i>section</i> has its <b>TITLE</b> in an H1 font. Sections are linked to in <i>Table of Contents</i> and have a dividing line drawn above them.</p>
<p>The body supports markdown.</p>
<p>There should only be one <code class="inline">_section:</code> per page.</p>
<p><b>Extensions:</b> <a href="/v5/documentation/#flatworm--ext-inherit">@inherit</a>, <a href="/v5/documentation/#flatworm--ext-src">@src</a>, <a href="/v5/documentation/#flatworm--ext-nav">@nav</a>, <a href="/v5/documentation/#flatworm--ext-note">@note</a></p>
</div></div><div class="definition"><div class="term"><b>_subsection:</b> <i>TITLE</i></div><div class="body"><p>A <i>subsection</i> has its <b>TITLE</b> in an H2 font. Subsections are linked to in <i>Table of Contents</i> and have a dividing line drawn above them.</p>
<p>The title and body support markdown.</p>
<p><b>Extensions:</b> <a href="/v5/documentation/#flatworm--ext-inherit">@inherit</a>, <a href="/v5/documentation/#flatworm--ext-src">@src</a>, <a href="/v5/documentation/#flatworm--ext-note">@note</a></p>
</div></div><div class="definition"><div class="term"><b>_heading:</b> <i>TITLE</i></div><div class="body"><p>A <i>heading</i> has its <b>TITLE</b> in an H3 font.</p>
<p>The title and body support markdown.</p>
<p><b>Extensions:</b> <a href="/v5/documentation/#flatworm--ext-inherit">@inherit</a>, <a href="/v5/documentation/#flatworm--ext-src">@src</a>, <a href="/v5/documentation/#flatworm--ext-note">@note</a></p>
</div></div><div class="definition"><div class="term"><b>_definition:</b> <i>TERM</i></div><div class="body"><p>A <i>definition</i> has its <b>TERM</b> in normal text and the body is indented.</p>
<p>The title and body support markdown.</p>
</div></div><div class="definition"><div class="term"><b>_property:</b> <i>SIGNATURE</i></div><div class="body"><p>A <i>property</i> has its JavaScript <b>SIGNATURE</b> formatted.</p>
<p>The body supports markdown and the return portion of the signature support markdown links.</p>
<p><b>Extensions:</b> <a href="/v5/documentation/#flatworm--ext-src">@src</a></p>
</div></div><div class="definition"><div class="term"><b>_note:</b> <i>BANNER</i></div><div class="body"><p>A <i>note</i> is placed in a blue bordered-box to draw attention to it.</p>
<p>The body supports markdown.</p>
</div></div><div class="definition"><div class="term"><b>_warning:</b> <i>BANNER</i></div><div class="body"><p>A <i>warning</i> is placed in an orange bordered-box to draw attention to it.</p>
<p>The body supports markdown.</p>
</div></div><div class="definition"><div class="term"><b>_code:</b> <i>CAPTION</i></div><div class="body"><p>Creates a <a href="/v5/documentation/#flatworm--code">Code</a> block.</p>
<p>The body does <b>not</b> support markdown, and will be output exactly as is, with the exception of <a href="/v5/documentation/#flatworm--code-eval">Code Evaluation</a>.</p>
<p>If a line begins with a <code class="inline">"_"</code>, it should be escaped with a <code class="inline">"\"</code>.</p>
<p><b>Extensions:</b> <a href="/v5/documentation/#flatworm--ext-lang">@lang</a></p>
</div></div><div class="definition"><div class="term"><b>_table:</b> <i>FOOTER</i></div><div class="body"><p>Creates a <a href="/v5/documentation/#flatworm--table">Table</a> structured according to the body.</p>
<p>Each cell contents supports markdown and variables supports markdown.</p>
<p><b>Extensions:</b> <a href="/v5/documentation/#flatworm--ext-style">@style</a></p>
</div></div><div class="definition"><div class="term"><b>_toc:</b></div><div class="body"><p>A <i>toc</i> injects a Table of Contents, loading each line of the body as a filename and recursively loads the <i>toc</i> if present, otherwise all the <i>sections</i> and <i>subsections</i>.</p>
<p>The body does <b>not</b> support markdown, as it is interpreted as a list of files and directories to process.</p>
</div></div><div class="definition"><div class="term"><b>_null:</b></div><div class="body"><p>A <i>null</i> is used to terminated a directive. For example, after a <i>definition</i>, the bodies are indented, so a <i>null</i> can be used to reset the indentation.</p>
<p>The body supports markdown.</p>
</div></div><div class="code-title"><div>Example</div></div><div class="code">_section: Hello World @&lt;link-main&gt;
Body for section...
_subsection: Some Example @&lt;link-secondary&gt;
Body for subsection...
_heading: Large Bold Text @&lt;link-here&gt;
Body for heading...
_definition: Flatworm
A phylum of relatively **simple** bilaterian, unsegmented,
soft-bodied invertebrates.
_property: String.fromCharCode(code) =&gt; string
Returns a string created from //code//, a sequence of
UTF-16 code units.
_code: heading
// Some code goes here
while(1);
_table: Table Footer
| **Name** | **Color** |
| Apple | Red |
| Banana | Yellow |
| Grape | Purple |
_toc:
some-file
some-directory
_note: Title
This is placed in a blue box.
_warning: Title
This is placed in an orange box.
_null:
This breaks out of a directive. For example, to end
a ``_note:`` or ``_code:``.</div><a name="flatworm-markdown"></a><a name="flatworm--flatworm-markdown"></a><h2 class="show-anchors"><div>Markdown<div class="anchors"><a class="self" href="/v5/documentation/#flatworm-markdown"></a></div></div></h2><p>The markdown is simple and does not have the flexibility of other dialects, but allows for <b>bold</b>, <i>italic</i>, <u>underlined</u>, <code class="inline">monospaced</code>, super<sup>script</sup> and <strike>strike</strike> text, supporting <a href="/v5/documentation/#flatworm-markdown">links</a> and lists.</p>
<p>Lists are rendered as blocks of a body, so cannot be used within a title or within another list.</p>
<div class="code">**bold text**
//italic text//
__underlined text__
``monospace code``
^^superscript text^^
~~strikeout text~~
- This is a list
- With bullet points
- With a total of three items
This is a [Link to Ethereum](https://ethereum.org) and this
is an [Internal Link](some-link).
This is a self-titled link [[https://ethereumorg]] and this
[[some-link]] will use the title from its directives value.</div><a name="flatworm--code"></a><a name="flatworm--flatworm--code"></a><h2 class="show-anchors"><div>Code<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--code"></a></div></div></h2><p>The code directive creates a monospace, contained block useful for displaying code samples.</p>
<a name="flatworm--code-eval"></a><a name="flatworm--flatworm--code--flatworm--code-eval"></a><h3 class="show-anchors"><div>JavaScript Evaluation<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--code-eval"></a></div></div></h3><p>For JavaScript files, the file is executed with some simple substitution.</p>
<p>A bare <code class="inline">//!</code> on a line is replaced with the result of the last statement. Building will fail if an error is thrown.</p>
<p>A bare <code class="inline">//!error</code> is replaced with the throw error. Building will fail if an error is not thrown.</p>
<p>Also any code included between the lines <b><code class="inline">// &lt;hide&gt;</code></b> and <b><code class="inline">// &lt;/hide&gt;</code></b> will be omitted from the output, which can be used to setup variables.</p>
<div class="code-title"><div>Code Evaluation Example</div></div><div class="code">_code: Result of Code Example @lang&lt;javascript&gt;
// &lt;hide&gt;
const url = require("url");
// &lt;/hide&gt;
url.parse("https://www.ricmoo.com/").protocol
//!
url.parse(45)
//! error
// You want to assign (doesn't emit eval) AND display the value
const foo = 4 + 5;
// &lt;hide&gt;
foo
// &lt;/hide&gt;
//!</div><div class="code-title"><div>Result of Code Example</div></div><div class="code">url.parse("https://www.ricmoo.com/").protocol
<span class="result ok">// 'https:'
</span>
url.parse(45)
<span class="result error">// Error: The "url" argument must be of type string. Received type number (45)
</span>
<span class="comment">// You want to assign (doesn't emit eval) AND display the value
</span>const foo = 4 + 5;
<span class="result ok">// 9
</span></div><a name="flatworm--flatworm--code--languages"></a><h3 class="show-anchors"><div>Languages<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--flatworm--code--languages"></a></div></div></h3><p>The language can be specified using the <a href="/v5/documentation/#flatworm--ext-lang">@lang extension</a>.</p>
<table class="table minimal"><tr><td align="center"><b>Language</b></td><td align="center"><b>Notes</b></td><td class="fix">&nbsp;</td></tr><tr><td align="center">javascript</td><td align="left">Syntax highlights and <a href="/v5/documentation/#flatworm--code-eval">evaluates</a> the JavaScript</td><td class="fix">&nbsp;</td></tr><tr><td align="center">script</td><td align="left">Same as <code class="inline">javascript</code>, but does not evaluate the results</td><td class="fix">&nbsp;</td></tr><tr><td align="center">shell</td><td align="left">Shell scripts or command-line</td><td class="fix">&nbsp;</td></tr><tr><td align="center">text</td><td align="left">Plain text with no syntax highlighting</td><td class="fix">&nbsp;</td></tr></table><a name="flatworm--table"></a><a name="flatworm--flatworm--table"></a><h2 class="show-anchors"><div>Tables<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--table"></a></div></div></h2><p>The table directive consumes the entire body up until the next directive. To terminate a table early to begin a text block, use a <b>_null:</b> directive.</p>
<p>Each line of the body should be <a href="/v5/documentation/#flatworm--table-row">Row Data</a> or a <a href="/v5/documentation/#flatworm--table-variable">Variable Declaration</a> (or continuation of a <i>Variable Declaration</i>). Blank lines are ignored.</p>
<a name="flatworm--table-row"></a><a name="flatworm--flatworm--table--flatworm--table-row"></a><h3 class="show-anchors"><div>Row Data<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--table-row"></a></div></div></h3><p>Each <b>Row Data</b> line must begin and end with a <b><code class="inline">"|"</code></b>, with each gap representing the cell data, <a href="/v5/documentation/#flatworm--table-alignment">alignment</a> with optional <a href="/v5/documentation/#flatworm--table-spanning">column and row spanning</a>.</p>
<a name="flatworm--table-alignment"></a><a name="flatworm--flatworm--table--flatworm--table-alignment"></a><h3 class="show-anchors"><div>Alignment<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--table-alignment"></a></div></div></h3><p>The alignment for a cell is determined by the whitespace surrounding the cell data.</p>
<table class="table minimal"><tr><td align="center"><b>Alignment</b></td><td align="center"><b>Whitespace</b></td><td class="fix">&nbsp;</td></tr><tr><td align="center"><i>Left</i></td><td align="left">1 or fewer spaces before the content</td><td class="fix">&nbsp;</td></tr><tr><td align="center"><i>Right</i></td><td align="left">1 or fewer spaces after the content</td><td class="fix">&nbsp;</td></tr><tr><td align="center"><i>Center</i></td><td align="left">2 or more space <b>both</b> before and after the content</td><td class="fix">&nbsp;</td></tr><tr><td class="table-title" colspan="2">Alignment Conditions (higher precedence listed first)</td><td class="fix">&nbsp;</td></tr></table><div class="code-title"><div>Alignment Example</div></div><div class="code">_table: Result of Alignment Example @style&lt;compact&gt;
| center |
| left |
|left |
| right |
| right|</div><table class="table compact"><tr><td align="center" width="100%">center</td><td class="fix">&nbsp;</td></tr><tr><td align="left" width="100%">left</td><td class="fix">&nbsp;</td></tr><tr><td align="left" width="100%">left</td><td class="fix">&nbsp;</td></tr><tr><td align="right" width="100%">right</td><td class="fix">&nbsp;</td></tr><tr><td align="right" width="100%">right</td><td class="fix">&nbsp;</td></tr><tr><td class="table-title" colspan="1">Result of Alignment Example</td><td class="fix">&nbsp;</td></tr></table><a name="flatworm--table-spanning"></a><a name="flatworm--flatworm--table--flatworm--table-spanning"></a><h3 class="show-anchors"><div>Row and Column Spanning<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--table-spanning"></a></div></div></h3><p>A column may end its content with any number of <b><code class="inline">"&lt;"</code></b> which indicates how many <i>additional</i> columns to extend into.</p>
<p>If the cell content contains only a <b><code class="inline">"^"</code></b>, then the row above is extended into this cell (into the same number of columns).</p>
<div class="code-title"><div>Cell Spanning Example</div></div><div class="code">_table: Result of Cell Spanning Example @style&lt;compact&gt;
| (1x1) | (1x2) &lt;| (2x1) |
| (2x2) &lt;| (2x1) | ^ |
| ^ | ^ | (1x1) |</div><table class="table compact"><tr><td align="center" width="25%">(1x1)</td><td align="center" colspan="2" width="50%">(1x2)</td><td align="center" rowspan="2" width="25%">(2x1)</td><td class="fix">&nbsp;</td></tr><tr><td align="center" colspan="2" rowspan="2" width="50%">(2x2)</td><td align="center" rowspan="2" width="25%">(2x1)</td><td class="fix">&nbsp;</td></tr><tr><td align="center" width="25%">(1x1)</td><td class="fix">&nbsp;</td></tr><tr><td class="table-title" colspan="4">Result of Cell Spanning Example</td><td class="fix">&nbsp;</td></tr></table><a name="flatworm--table-style"></a><a name="flatworm--flatworm--table--flatworm--table-style"></a><h3 class="show-anchors"><div>Styles<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--table-style"></a></div></div></h3><p>The <a href="/v5/documentation/#flatworm--ext-style">@style extension</a> for a table can be used to control its appearance.</p>
<table class="table minimal"><tr><td align="center"><b>Name</b></td><td align="center"><b>Width</b></td><td align="center"><b>Columns</b></td><td class="fix">&nbsp;</td></tr><tr><td align="center"><i>minimal</i></td><td align="center">minimum size</td><td align="center">best fit</td><td class="fix">&nbsp;</td></tr><tr><td align="center"><i>compact</i></td><td align="center">40%</td><td align="center">evenly spaced</td><td class="fix">&nbsp;</td></tr><tr><td align="center"><i>wide</i></td><td align="center">67%</td><td align="center">evenly spaced</td><td class="fix">&nbsp;</td></tr><tr><td align="center"><i>full</i></td><td align="center">100%</td><td align="center">evenly spaced</td><td class="fix">&nbsp;</td></tr></table><a name="flatworm--table-variable"></a><a name="flatworm--flatworm--table--flatworm--table-variable"></a><h3 class="show-anchors"><div>Variables<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--table-variable"></a></div></div></h3><p>Often the layout of a table is easier to express and maintain without uneven or changing content within it. So the content can be defined separately within a table directive using <b>variables</b>. A variable name must begin with a letter and must only contain letters and numbers.</p>
<p>Variables are also useful when content is repeated throughout a table.</p>
<p>A variable is declared by starting a line with <code class="inline">"$NAME:"</code>, which consumes all lines until the next variable declaration or until the next table row line.</p>
<p>A variable name must start with a letter and may consist of letters and numbers. (i.e. <code class="inline">/[a-z][a-z0-9]*/i</code>)</p>
<div class="code-title"><div>Variables Example</div></div><div class="code">_table: Result of Variables Example
$Yes: This option is supported.
$No: This option is **not** supported
$bottom: This just represents an example of
what is possible. Notice that variable
content can span multiple lines.
| **Feature** | **Supported** |
| Dancing Monkey | $Yes |
| Singing Turtle | $No |
| Newt Hair | $Yes |
| $bottom &lt;|</div><table class="table minimal"><tr><td align="center"><b>Feature</b></td><td align="center"><b>Supported</b></td><td class="fix">&nbsp;</td></tr><tr><td align="center">Dancing Monkey</td><td align="center">This option is supported.</td><td class="fix">&nbsp;</td></tr><tr><td align="center">Singing Turtle</td><td align="center">This option is <b>not</b> supported.</td><td class="fix">&nbsp;</td></tr><tr><td align="center">Newt Hair</td><td align="center">This option is supported.</td><td class="fix">&nbsp;</td></tr><tr><td align="center" colspan="2">This just represents an example of what is possible. Notice that variable content can span multiple lines.</td><td class="fix">&nbsp;</td></tr><tr><td class="table-title" colspan="2">Result of Variables Example</td><td class="fix">&nbsp;</td></tr></table><a name="flatworm-config"></a><a name="flatworm--flatworm-config"></a><h2 class="show-anchors"><div>Configuration<div class="anchors"><a class="self" href="/v5/documentation/#flatworm-config"></a></div></div></h2><p>Configuration is optional (but highly recommended) and may be either a simple JSON file (config.json) or a JS file (config.js) placed in the top of the source folder.</p>
<p>TODO: example JSON and example JS</p>
<a name="flatworm-extensions"></a><a name="flatworm--flatworm-extensions"></a><h2 class="show-anchors"><div>Extensions<div class="anchors"><a class="self" href="/v5/documentation/#flatworm-extensions"></a></div></div></h2>
<a name="flatworm--ext-inherit"></a><a name="flatworm--flatworm-extensions--flatworm--ext-inherit"></a><h3 class="show-anchors"><div>@inherit&lt; <i>markdown</i> &gt;<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--ext-inherit"></a></div></div></h3><p>Adds an inherits description to a directive. The <i>markdown</i> may contain links.</p>
<a name="flatworm--ext-lang"></a><a name="flatworm--flatworm-extensions--flatworm--ext-lang"></a><h3 class="show-anchors"><div>@lang&lt; <i>text</i> &gt;<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--ext-lang"></a></div></div></h3><p>Set the language a <a href="/v5/documentation/#flatworm--code">code directive</a> should be syntax-highlighted for. If "javascript", the code will be evaluated.</p>
<a name="flatworm--ext-nav"></a><a name="flatworm--flatworm-extensions--flatworm--ext-nav"></a><h3 class="show-anchors"><div>@nav&lt; <i>text</i> &gt;<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--ext-nav"></a></div></div></h3><p>Sets the name in the breadcrumbs when not the current node.</p>
<a name="flatworm--ext-note"></a><a name="flatworm--flatworm-extensions--flatworm--ext-note"></a><h3 class="show-anchors"><div>@note&lt;<i> markdown</i> &gt;<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--ext-note"></a></div></div></h3><p>Adds a note to a directive. The <i>markdown</i> may contain links. If the directive already has an @INHERIT extension, that will be used instead and the @NOTE will be ignored.</p>
<a name="flatworm--ext-src"></a><a name="flatworm--flatworm-extensions--flatworm--ext-src"></a><h3 class="show-anchors"><div>@src&lt; <i>key</i> &gt;<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--ext-src"></a></div></div></h3><p>Calls the configuration <code class="inline">getSourceUrl(key, VALUE)</code> to get a URL which will be linked to by a link next to the <i>directive</i>.</p>
<p>This extended directive function requires an advanced <code class="inline">config.js</code> <a href="/v5/documentation/#flatworm-config">Configuration</a> file since it requires a JavaScript function.</p>
<a name="flatworm--ext-style"></a><a name="flatworm--flatworm-extensions--flatworm--ext-style"></a><h3 class="show-anchors"><div>@style&lt; <i>text</i> &gt;<div class="anchors"><a class="self" href="/v5/documentation/#flatworm--ext-style"></a></div></div></h3><p>The <a href="/v5/documentation/#flatworm--table-style">Table Style</a> to use for a table directive.</p>
<div class="footer">
<div class="nav previous"><a href="/v5/other-resources/"><span class="arrow">&larr;</span>Other Resources</a></div>
<div class="nav next"><a href="/v5/license/">License and Copyright<span class="arrow">&rarr;</span></a></div>
</div>
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on February 8, 2021, 3:25pm.</div>
</div>
<script src="/v5/static/script.js" type="text/javascript"></script>
<!--EXTRASCRIPT-->
</body>
</html>