{"route":"/en-US-v0.13.1/reference/model/enum/","title":"Numbered List","description":"Documentation for the `enum` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"example","name":"Example","children":[]},{"id":"syntax","name":"Syntax","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-tight","name":"tight","children":[]},{"id":"parameters-numbering","name":"numbering","children":[]},{"id":"parameters-start","name":"start","children":[]},{"id":"parameters-full","name":"full","children":[]},{"id":"parameters-reversed","name":"reversed","children":[]},{"id":"parameters-indent","name":"indent","children":[]},{"id":"parameters-body-indent","name":"body-indent","children":[]},{"id":"parameters-spacing","name":"spacing","children":[]},{"id":"parameters-number-align","name":"number-align","children":[]},{"id":"parameters-children","name":"children","children":[]}]},{"id":"definitions","name":"Definitions","children":[{"id":"definitions-item","name":"Numbered List Item","children":[{"id":"definitions-item-number","name":"number","children":[]},{"id":"definitions-item-body","name":"body","children":[]}]}]}],"body":{"kind":"func","content":{"path":[],"name":"enum","title":"Numbered List","keywords":[],"oneliner":"A numbered list.","element":true,"contextual":false,"deprecation":null,"details":"<p>A numbered list.</p>\n<p>Displays a sequence of items vertically and numbers them consecutively.</p>\n<h2 id=\"example\">Example</h2>\n<div class=\"previewed-code\"><pre><code>Automatically numbered:\n<span class=\"typ-marker\">+</span> Preparations\n<span class=\"typ-marker\">+</span> Analysis\n<span class=\"typ-marker\">+</span> Conclusions\n\nManually numbered:\n<span class=\"typ-marker\">2.</span> What is the first step?\n<span class=\"typ-marker\">5.</span> I am confused.\n<span class=\"typ-marker\">+</span>  Moving on <span class=\"typ-escape\">...</span>\n\nMultiple lines:\n<span class=\"typ-marker\">+</span> This enum item has multiple\n  lines because the next line\n  is indented.\n\nFunction call.\n<span class=\"typ-func\">#</span><span class=\"typ-func\">enum</span><span class=\"typ-punct\">[</span>First<span class=\"typ-punct\">]</span><span class=\"typ-punct\">[</span>Second<span class=\"typ-punct\">]</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/1eb9c9d6644abdb5cd7fa5380e664268.png\" alt=\"Preview\"></div></div>\n<p>You can easily switch all your enumerations to a different numbering style\nwith a set rule.</p>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">enum</span><span class=\"typ-punct\">(</span>numbering<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;a)&quot;</span><span class=\"typ-punct\">)</span>\n\n<span class=\"typ-marker\">+</span> Starting off <span class=\"typ-escape\">...</span>\n<span class=\"typ-marker\">+</span> Don&#39;t forget step two\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/8456faf1af030be46f7ff78c398b5533.png\" alt=\"Preview\"></div></div>\n<p>You can also use <a href=\"/en-US-v0.13.1/reference/model/enum/#definitions-item\"><code>enum.item</code></a> to programmatically customize the\nnumber of each item in the enumeration:</p>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">enum</span><span class=\"typ-punct\">(</span>\n  enum<span class=\"typ-punct\">.</span><span class=\"typ-func\">item</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">1</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>First step<span class=\"typ-punct\">]</span><span class=\"typ-punct\">,</span>\n  enum<span class=\"typ-punct\">.</span><span class=\"typ-func\">item</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">5</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>Fifth step<span class=\"typ-punct\">]</span><span class=\"typ-punct\">,</span>\n  enum<span class=\"typ-punct\">.</span><span class=\"typ-func\">item</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">10</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>Tenth step<span class=\"typ-punct\">]</span>\n<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/b9141b8d7ae4bfb17096d07196e54c30.png\" alt=\"Preview\"></div></div>\n<h2 id=\"syntax\">Syntax</h2>\n<p>This functions also has dedicated syntax:</p>\n<ul>\n<li>Starting a line with a plus sign creates an automatically numbered\nenumeration item.</li>\n<li>Starting a line with a number followed by a dot creates an explicitly\nnumbered enumeration item.</li>\n</ul>\n<p>Enumeration items can contain multiple paragraphs and other block-level\ncontent. All content that is indented more than an item's marker becomes\npart of that item.</p>","example":null,"self":false,"params":[{"name":"tight","details":"<p>Defines the default <a href=\"/en-US-v0.13.1/reference/model/enum/#parameters-spacing\">spacing</a> of the enumeration. If it\nis <code><span class=\"typ-key\">false</span></code>, the items are spaced apart with\n<a href=\"/en-US-v0.13.1/reference/model/par/#parameters-spacing\">paragraph spacing</a>. If it is <code><span class=\"typ-key\">true</span></code>, they use\n<a href=\"/en-US-v0.13.1/reference/model/par/#parameters-leading\">paragraph leading</a> instead. This makes the list more\ncompact, which can look better if the items are short.</p>\n<p>In markup mode, the value of this parameter is determined based on\nwhether items are separated with a blank line. If items directly follow\neach other, this is set to <code><span class=\"typ-key\">true</span></code>; if items are separated by a blank\nline, this is set to <code><span class=\"typ-key\">false</span></code>. The markup-defined tightness cannot be\noverridden with set rules.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-marker\">+</span> If an enum has a lot of text, and\n  maybe other inline content, it\n  should not be tight anymore.\n\n<span class=\"typ-marker\">+</span> To make an enum wide, simply\n  insert a blank line between the\n  items.\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/860a2d566023cbbb1db95dcf595b00d.png\" alt=\"Preview\"></div></div>","types":["bool"],"strings":[],"default":"<code><span class=\"typ-key\">true</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"numbering","details":"<p>How to number the enumeration. Accepts a\n<a href=\"/en-US-v0.13.1/reference/model/numbering/\">numbering pattern or function</a>.</p>\n<p>If the numbering pattern contains multiple counting symbols, they apply\nto nested enums. If given a function, the function receives one argument\nif <code>full</code> is <code><span class=\"typ-key\">false</span></code> and multiple arguments if <code>full</code> is <code><span class=\"typ-key\">true</span></code>.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">enum</span><span class=\"typ-punct\">(</span>numbering<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;1.a)&quot;</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-marker\">+</span> Different\n<span class=\"typ-marker\">+</span> Numbering\n  <span class=\"typ-marker\">+</span> Nested\n  <span class=\"typ-marker\">+</span> Items\n<span class=\"typ-marker\">+</span> Style\n\n<span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">enum</span><span class=\"typ-punct\">(</span>numbering<span class=\"typ-punct\">:</span> n <span class=\"typ-op\">=&gt;</span> <span class=\"typ-func\">super</span><span class=\"typ-punct\">[</span><span class=\"typ-pol\">#</span><span class=\"typ-pol\">n</span><span class=\"typ-punct\">]</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-marker\">+</span> Superscript\n<span class=\"typ-marker\">+</span> Numbering!\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/6ffe69a133dcf921fd85cc0ea784dc6c.png\" alt=\"Preview\"></div></div>","types":["str","function"],"strings":[],"default":"<code><span class=\"typ-str\">&quot;1.&quot;</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"start","details":"<p>Which number to start the enumeration with.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">enum</span><span class=\"typ-punct\">(</span>\n  start<span class=\"typ-punct\">:</span> <span class=\"typ-num\">3</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">[</span>Skipping<span class=\"typ-punct\">]</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">[</span>Ahead<span class=\"typ-punct\">]</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/36a68c2147cbb6bab67e17fdc428636a.png\" alt=\"Preview\"></div></div>","types":["auto","int"],"strings":[],"default":"<code><span class=\"typ-key\">auto</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"full","details":"<p>Whether to display the full numbering, including the numbers of\nall parent enumerations.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">enum</span><span class=\"typ-punct\">(</span>numbering<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;1.a)&quot;</span><span class=\"typ-punct\">,</span> full<span class=\"typ-punct\">:</span> <span class=\"typ-key\">true</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-marker\">+</span> Cook\n  <span class=\"typ-marker\">+</span> Heat water\n  <span class=\"typ-marker\">+</span> Add ingredients\n<span class=\"typ-marker\">+</span> Eat\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/79c2f47e7f76011c7feb16cb65816454.png\" alt=\"Preview\"></div></div>","types":["bool"],"strings":[],"default":"<code><span class=\"typ-key\">false</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"reversed","details":"<p>Whether to reverse the numbering for this enumeration.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">enum</span><span class=\"typ-punct\">(</span>reversed<span class=\"typ-punct\">:</span> <span class=\"typ-key\">true</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-marker\">+</span> Coffee\n<span class=\"typ-marker\">+</span> Tea\n<span class=\"typ-marker\">+</span> Milk\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/5528dd706f7b5b1f480846f2534d812c.png\" alt=\"Preview\"></div></div>","types":["bool"],"strings":[],"default":"<code><span class=\"typ-key\">false</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"indent","details":"<p>The indentation of each item.</p>","example":null,"types":["length"],"strings":[],"default":"<code><span class=\"typ-num\">0pt</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"body-indent","details":"<p>The space between the numbering and the body of each item.</p>","example":null,"types":["length"],"strings":[],"default":"<code><span class=\"typ-num\">0.5em</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"spacing","details":"<p>The spacing between the items of the enumeration.</p>\n<p>If set to <code><span class=\"typ-key\">auto</span></code>, uses paragraph <a href=\"/en-US-v0.13.1/reference/model/par/#parameters-leading\"><code>leading</code></a> for tight\nenumerations and paragraph <a href=\"/en-US-v0.13.1/reference/model/par/#parameters-spacing\"><code>spacing</code></a> for wide\n(non-tight) enumerations.</p>","example":null,"types":["auto","length"],"strings":[],"default":"<code><span class=\"typ-key\">auto</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"number-align","details":"<p>The alignment that enum numbers should have.</p>\n<p>By default, this is set to <code>end <span class=\"typ-op\">+</span> top</code>, which aligns enum numbers\ntowards end of the current text direction (in left-to-right script,\nfor example, this is the same as <code>right</code>) and at the top of the line.\nThe choice of <code>end</code> for horizontal alignment of enum numbers is\nusually preferred over <code>start</code>, as numbers then grow away from the\ntext instead of towards it, avoiding certain visual issues. This option\nlets you override this behaviour, however. (Also to note is that the\n<a href=\"/en-US-v0.13.1/reference/model/list/\">unordered list</a> uses a different method for this, by giving the\n<code>marker</code> content an alignment directly.).</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">enum</span><span class=\"typ-punct\">(</span>number-align<span class=\"typ-punct\">:</span> start <span class=\"typ-op\">+</span> bottom<span class=\"typ-punct\">)</span>\n\nHere are some powers of two:\n<span class=\"typ-marker\">1.</span> One\n<span class=\"typ-marker\">2.</span> Two\n<span class=\"typ-marker\">4.</span> Four\n<span class=\"typ-marker\">8.</span> Eight\n<span class=\"typ-marker\">16.</span> Sixteen\n<span class=\"typ-marker\">32.</span> Thirty two\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/b3ecd497dafdcfac8a756e159ec2e2fc.png\" alt=\"Preview\"></div></div>","types":["alignment"],"strings":[],"default":"<code>end <span class=\"typ-op\">+</span> top</code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"children","details":"<p>The numbered list's items.</p>\n<p>When using the enum syntax, adjacent items are automatically collected\ninto enumerations, even through constructs like for loops.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">for</span> phase <span class=\"typ-key\">in</span> <span class=\"typ-punct\">(</span>\n   <span class=\"typ-str\">&quot;Launch&quot;</span><span class=\"typ-punct\">,</span>\n   <span class=\"typ-str\">&quot;Orbit&quot;</span><span class=\"typ-punct\">,</span>\n   <span class=\"typ-str\">&quot;Descent&quot;</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span> <span class=\"typ-punct\">[</span><span class=\"typ-marker\">+</span> <span class=\"typ-pol\">#</span><span class=\"typ-pol\">phase</span><span class=\"typ-punct\">]</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/f616921cf92bf200c0c7ed5c12d99ff1.png\" alt=\"Preview\"></div></div>","types":["content","array"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":true,"settable":false}],"returns":["content"],"scope":[{"path":["enum"],"name":"item","title":"Numbered List Item","keywords":[],"oneliner":"An enumeration item.","element":true,"contextual":false,"deprecation":null,"details":"<p>An enumeration item.</p>","example":null,"self":false,"params":[{"name":"number","details":"<p>The item's number.</p>","example":null,"types":["none","int"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":true,"named":false,"required":false,"variadic":false,"settable":true},{"name":"body","details":"<p>The item's body.</p>","example":null,"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[]}]}}}