kotlinx.html icon indicating copy to clipboard operation
kotlinx.html copied to clipboard

Improve the documentation on custom tags

Open reubenfirmin opened this issue 1 year ago • 0 comments

It's pretty barebones: https://github.com/Kotlin/kotlinx.html/wiki/Micro-templating-and-DSL-customizing

How do we add custom attributes? StringAttribute exists and seems to be the thing, but there are no examples of how to use it, and no javadoc.

Let's take the following example as something we want to be able to do based on the docs. SVG is incomplete, so we want to be able to extend it in order to support the following:

                    svg("w-6 h-6") {
                        fill = "currentColor"
                        viewbox = "0 0 20 20"
                        xmlns = "http://www.w3.org/2000/svg"
                        path {
                             fillRule = "evenodd"
                             d =
                                 "M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
                             clipRule = "evenodd"
                         }
                     }

How do we even start? The docs should give us enough information to understand how to proceed.

reubenfirmin avatar Oct 26 '23 21:10 reubenfirmin