{"route":"/en-US-v0.14.1/reference/html/elem/","title":"Elem","description":"Documentation for the `elem` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-tag","name":"tag","children":[]},{"id":"parameters-attrs","name":"attrs","children":[]},{"id":"parameters-body","name":"body","children":[]}]}],"body":{"kind":"func","content":{"path":["html"],"name":"elem","title":"Elem","keywords":[],"oneliner":"An HTML element that can contain Typst content.","element":true,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>An HTML element that can contain Typst content.</p>\n<p>Typst's HTML export automatically generates the appropriate tags for most\nelements. However, sometimes, it is desirable to retain more control. For\nexample, when using Typst to generate your blog, you could use this function\nto wrap each article in an <code>&lt;article&gt;</code> tag.</p>\n<p>Typst is aware of what is valid HTML. A tag and its attributes must form\nsyntactically valid HTML. Some tags, like <code>meta</code> do not accept content.\nHence, you must not provide a body for them. We may add more checks in the\nfuture, so be sure that you are generating valid HTML when using this\nfunction.</p>\n<p>Normally, Typst will generate <code>html</code>, <code>head</code>, and <code>body</code> tags for you. If\nyou instead create them with this function, Typst will omit its own tags.</p>\n<pre><code><span class=\"typ-pol\">#</span><span class=\"typ-pol\">html</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">elem</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;div&quot;</span><span class=\"typ-punct\">,</span> attrs<span class=\"typ-punct\">:</span> <span class=\"typ-punct\">(</span>style<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;background: aqua&quot;</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>\n  A div with <span class=\"typ-emph\">_Typst content_</span> inside!\n<span class=\"typ-punct\">]</span>\n</code></pre>"}],"self":false,"params":[{"name":"tag","details":[{"kind":"html","content":"<p>The element's tag.</p>"}],"types":["str"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"attrs","details":[{"kind":"html","content":"<p>The element's HTML attributes.</p>"}],"types":["dictionary"],"strings":[],"default":"<code><span class=\"typ-punct\">(</span><span class=\"typ-punct\">:</span><span class=\"typ-punct\">)</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"body","details":[{"kind":"html","content":"<p>The contents of the HTML element.</p>\n<p>The body can be arbitrary Typst content.</p>"}],"types":["none","content"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":true,"named":false,"required":false,"variadic":false,"settable":true}],"returns":["content"],"scope":[]}}}