nml/readme/Sections.html
2024-11-03 14:12:43 +01:00

1 line
No EOL
7.8 KiB
HTML

<!DOCTYPE HTML><html><head><meta charset="UTF-8"><title>NML | Sections</title><link rel="stylesheet" href="../style.css"></head><body><div class="layout"><input id="navbar-checkbox" class="toggle" type="checkbox" style="display:none" checked><div id="navbar"><ul><li class="navbar-entry"><a href="Getting Started.html">Getting Started</a></li><li class="navbar-entry-current"><a href="Sections.html">Sections</a></li><li class="navbar-entry"><a href="Variables.html">Variables</a></li><li class="navbar-entry"><a href="References.html">References</a></li><li class="navbar-entry"><a href="Imports.html">Imports</a></li><li class="navbar-entry"><a href="Raw.html">Raw</a></li><li class="navbar-entry"><a href="Comments.html">Comments</a></li><li><details><summary class="navbar-category">External Tools</summary><ul><li class="navbar-entry"><a href="Graphviz.html">Graphviz</a></li><li class="navbar-entry"><a href="LaTeX.html">LaTeX</a></li></ul></details></li><li><details><summary class="navbar-category">Blocks</summary><ul><li class="navbar-entry"><a href="Blockquotes.html">Blockquotes</a></li><li class="navbar-entry"><a href="Code.html">Code</a></li><li class="navbar-entry"><a href="Lists.html">Lists</a></li></ul></details></li><li><details><summary class="navbar-category">Lua</summary><ul><li class="navbar-entry"><a href="Lua Basics.html">Lua</a></li></ul></details></li><li><details><summary class="navbar-category">Styles</summary><ul><li class="navbar-entry"><a href="Basic Styles.html">Basic</a></li><li class="navbar-entry"><a href="Basic Layouts.html">Layouts</a></li><li class="navbar-entry"><a href="User-Defined Styles.html">User-Defined</a></li></ul></details></li></ul></div><label for="navbar-checkbox" class="navbar-checkbox-label">&#9776;</label><div class="content"><div class="toc"><span>Table of Content</span><ol><li value="1"><a href="#Sections">Sections</a></li><li value="2"><a href="#Sections_references">Sections references</a></li><li value="3"><a href="#Table_of_Content">Table of Content</a></li><li value="4"><a href="#Section_styling">Section styling</a></li><li value="5"><a href="#Bindings">Bindings</a></li></div><h1 id="Sections">1. Sections <a class="section-link" href="#Sections">🔗 </a> </h1><p>To add a section to your document, put one or more <a class="inline-code"><code><span style="color:#c0c5ce;">#</span></code></a> at the start of the line, followed a space and the name of your section.</p><p>Which will render as:</p><div class="split-container"><div class="split"><p></p><h1 id="Section_name">2. Section name <a class="section-link" href="#Section_name">🔗 </a> </h1><h2 id="Subsection">2.1. Subsection <a class="section-link" href="#Subsection">🔗 </a> </h2><h2 id="Unnumbered_section">Unnumbered section <a class="section-link" href="#Unnumbered_section">🔗 </a> </h2><h2 id="Unnumbered_section">2.2. Unnumbered section <a class="section-link" href="#Unnumbered_section">🔗 </a> </h2><h1 id="This_section_is_not_in_the_ToC">2. This section is not in the ToC <a class="section-link" href="#This_section_is_not_in_the_ToC">🔗 </a> </h1></div><div class="split"><p>Given by the following:</p><div class="code-block"><div class="code-block-content"><table cellspacing="0"><tr><td class="code-block-line"><pre><span style="color:#c0c5ce;"># Section name</span></pre></td></tr><tr><td class="code-block-line"><pre><span style="color:#c0c5ce;">## Subsection</span></pre></td></tr><tr><td class="code-block-line"><pre><span style="color:#c0c5ce;">#* Unnumbered section</span></pre></td></tr><tr><td class="code-block-line"><pre><span style="color:#c0c5ce;">#+ This section is not in the ToC</span></pre></td></tr></table></div></div></div></div><h1 id="Sections_references">3. Sections references <a class="section-link" href="#Sections_references">🔗 </a> </h1><p>You can create a referenceable section by using <a class="inline-code"><code><span style="color:#c0c5ce;">#{refname}</span></code></a>, where <em>refname</em> is an internal reference name for use only within this document. You can then create a clickable reference to this section: <a class="inline-code"><code><span style="color:#c0c5ce;">§{refname}</span></code></a> or <a class="inline-code"><code><span style="color:#c0c5ce;">§{refname}[caption=Click me!]</span></code></a>. Below is an example of this in action:</p><h3 id="Section">Section <a class="section-link" href="#Section">🔗 </a> </h3><p>§{refname}[caption=Click me!] or §{first}[caption=First section]</p><div class="code-block"><div class="code-block-content"><table cellspacing="0"><tr><td class="code-block-line"><pre><span style="color:#c0c5ce;">###{refname}+* Section</span></pre></td></tr><tr><td class="code-block-line"><pre><span style="color:#c0c5ce;">§{refname}[caption=Click me!] or §{first}[caption=First section]</span></pre></td></tr></table></div></div><h1 id="Table_of_Content">4. Table of Content <a class="section-link" href="#Table_of_Content">🔗 </a> </h1><p>Section can be automatically exported to a table of content, such as shown at the top of this document. To create a table of content, simply add <a class="inline-code"><code><span style="color:#c0c5ce;">#+TABLE_OF_CONTENT</span></code></a> somewhere in your document and it will be displayed there.</p><h1 id="Section_styling">5. Section styling <a class="section-link" href="#Section_styling">🔗 </a> </h1><p>The styling for the section link is controlled by the style key <a class="inline-code"><code><span style="color:#c0c5ce;">style.section</span></code></a></p><ul><li><a class="inline-code"><code><span style="color:#c0c5ce;">link_pos</span></code></a>: <em>Before|After|None</em> Position of the section link.</li><li><a class="inline-code"><code><span style="color:#c0c5ce;">link</span></code></a>: <em>[Before, Link, After]</em> 3 strings-array</li></ul><div class="code-block"><div class="code-block-title">Default Style</div><div class="code-block-content"><table cellspacing="0"><tr><td class="code-block-gutter"><pre><span>1</span></pre></td><td class="code-block-line"><pre><span style="color:#c0c5ce;">{</span></pre></td></tr><tr><td class="code-block-gutter"><pre><span>2</span></pre></td><td class="code-block-line"><pre><span style="color:#c0c5ce;"> &quot;</span><span style="color:#a3be8c;">link_pos</span><span style="color:#c0c5ce;">&quot;: &quot;</span><span style="color:#a3be8c;">Before</span><span style="color:#c0c5ce;">&quot;,</span></pre></td></tr><tr><td class="code-block-gutter"><pre><span>3</span></pre></td><td class="code-block-line"><pre><span style="color:#c0c5ce;"> &quot;</span><span style="color:#a3be8c;">link</span><span style="color:#c0c5ce;">&quot;: [&quot;&quot;, &quot;</span><span style="color:#a3be8c;">🔗</span><span style="color:#c0c5ce;">&quot;, &quot; &quot;]</span></pre></td></tr><tr><td class="code-block-gutter"><pre><span>4</span></pre></td><td class="code-block-line"><pre><span style="color:#c0c5ce;">}</span></pre></td></tr></table></div></div><h1 id="Bindings">6. Bindings <a class="section-link" href="#Bindings">🔗 </a> </h1><ul><li><a class="inline-code"><code><span style="color:#c0c5ce;">nml.section.push(title, depth, [, kind [, reference]])</span></code></a></li><ul><li><a class="inline-code"><code><span style="color:#c0c5ce;">title</span></code></a> <i>(string)</i> the section display title</li><li><a class="inline-code"><code><span style="color:#c0c5ce;">depth</span></code></a> <i>(number)</i> the section depth</li><li><a class="inline-code"><code><span style="color:#c0c5ce;">kind</span></code></a> <i>(string)</i> the section kind</li><ol><li value="1"><em>*</em> for unnumbered</li><li value="2"><em>+</em> for outside of the table of content</li><li value="3"><em>*+</em> or <em>+*</em> for both</li></ol><li><a class="inline-code"><code><span style="color:#c0c5ce;">reference</span></code></a> <i>(string)</i> the section reference name</li></ul></ul><p></p></div></div></body></html>