Simple HTML Generation https://minihtml.trendels.name/

Document boolean attributes

+16
+16
docs/source/basics.rst
··· 172 172 >>> print(div(attr='a value with "quotes" and a <tag>')) 173 173 <div attr="a value with &quot;quotes&quot; and a &lt;tag&gt;"></div> 174 174 175 + Boolean attributes 176 + ^^^^^^^^^^^^^^^^^^ 177 + 178 + A boolean HTML attribute is one that does not have a value. For example, to 179 + mark an input field as required, you can write ``<input required>``. There is 180 + also an alternative syntax, which minihtml uses: ``<input 181 + required="required">``. 182 + 183 + To set a boolean attribute, pass ``True`` as the value. ``False`` is also a 184 + valid value, and causes the attribute to be omitted (this can be useful if you 185 + set the attribute from a variable): 186 + 187 + >>> from minihtml.tags import input 188 + >>> print(input(required=True, disabled=False)) 189 + <input required="required"> 190 + 175 191 .. _content: 176 192 177 193 Content