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

1 line
No EOL
6.4 KiB
HTML

<!DOCTYPE HTML><html><head><meta charset="UTF-8"><title>NML | User-Defined Styles</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"><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 open><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-current"><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="#Defining_a_custom_style">Defining a custom style</a></li><li value="2"><a href="#Limitations">Limitations</a></li></div><h1 id="Defining_a_custom_style">1. Defining a custom style <a class="section-link" href="#Defining_a_custom_style">🔗 </a> </h1><div class="code-block"><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:#b48ead;">function </span><span style="color:#8fa1b3;">undercustom_start</span><span style="color:#c0c5ce;">(color)</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;"> nml.raw.push(&quot;</span><span style="color:#a3be8c;">inline</span><span style="color:#c0c5ce;">&quot;, &quot;</span><span style="color:#a3be8c;">&lt;span style=</span><span style="color:#96b5b4;">\&quot;</span><span style="color:#a3be8c;">border-bottom: 1px dashed </span><span style="color:#c0c5ce;">&quot; .. color .. &quot;</span><span style="color:#96b5b4;">\&quot;</span><span style="color:#a3be8c;">&gt;</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:#b48ead;">end</span></pre></td></tr><tr><td class="code-block-gutter"><pre><span>4</span></pre></td><td class="code-block-line"><pre><br></pre></td></tr><tr><td class="code-block-gutter"><pre><span>5</span></pre></td><td class="code-block-line"><pre><span style="color:#b48ead;">function </span><span style="color:#8fa1b3;">undercustom_end</span><span style="color:#c0c5ce;">()</span></pre></td></tr><tr><td class="code-block-gutter"><pre><span>6</span></pre></td><td class="code-block-line"><pre><span style="color:#c0c5ce;"> nml.raw.push(&quot;</span><span style="color:#a3be8c;">inline</span><span style="color:#c0c5ce;">&quot;, &quot;</span><span style="color:#a3be8c;">&lt;/span&gt;</span><span style="color:#c0c5ce;">&quot;)</span></pre></td></tr><tr><td class="code-block-gutter"><pre><span>7</span></pre></td><td class="code-block-line"><pre><span style="color:#b48ead;">end</span></pre></td></tr><tr><td class="code-block-gutter"><pre><span>8</span></pre></td><td class="code-block-line"><pre><br></pre></td></tr><tr><td class="code-block-gutter"><pre><span>9</span></pre></td><td class="code-block-line"><pre><span style="color:#c0c5ce;">nml.custom_style.define_toggled(&quot;</span><span style="color:#a3be8c;">Undercustom Red</span><span style="color:#c0c5ce;">&quot;, &quot;</span><span style="color:#a3be8c;">~</span><span style="color:#c0c5ce;">&quot;, </span><span style="color:#b48ead;">function</span><span style="color:#c0c5ce;">() undercustom_start(&quot;</span><span style="color:#a3be8c;">red</span><span style="color:#c0c5ce;">&quot;) </span><span style="color:#b48ead;">end</span><span style="color:#c0c5ce;">, undercustom_end)</span></pre></td></tr><tr><td class="code-block-gutter"><pre><span>10</span></pre></td><td class="code-block-line"><pre><span style="color:#c0c5ce;">nml.custom_style.define_paired(&quot;</span><span style="color:#a3be8c;">Undercustom Green</span><span style="color:#c0c5ce;">&quot;, &quot;</span><span style="color:#a3be8c;">[|</span><span style="color:#c0c5ce;">&quot;, &quot;</span><span style="color:#a3be8c;">|]</span><span style="color:#c0c5ce;">&quot;, </span><span style="color:#b48ead;">function</span><span style="color:#c0c5ce;">() undercustom_start(&quot;</span><span style="color:#a3be8c;">green</span><span style="color:#c0c5ce;">&quot;) </span><span style="color:#b48ead;">end</span><span style="color:#c0c5ce;">, undercustom_end)</span></pre></td></tr><tr><td class="code-block-gutter"><pre><span>11</span></pre></td><td class="code-block-line"><pre><span style="color:#c0c5ce;">&gt;%</span></pre></td></tr></table></div></div><p>Results in the following:</p><ul><li><a class="inline-code"><code><span style="color:#c0c5ce;">~Dashed underline~</span></code></a><span style="border-bottom: 1px dashed red">Dashed underline</span></li><li><a class="inline-code"><code><span style="color:#c0c5ce;">[|Dashed underline|]</span></code></a><span style="border-bottom: 1px dashed green">Dashed underline</span></li></ul><h1 id="Limitations">2. Limitations <a class="section-link" href="#Limitations">🔗 </a> </h1><ul><li>Custom styles cannot be removed and will be defined through the entire document</li><li>Custom styles defined from lua must have their <em>start</em> and <em>end</em> functions in the <em>main</em> lua kernel.</li></ul><p></p></div></div></body></html>