The FlowOrHeadingContent.h1 method can accept class as an argument, but not other parameters.
In general, we want to pass through all or most parameters unchanged.
The ideal syntax that maintains back-compatability would likely be an overload
inline fun FlowOrHeadingContent.h1(classes : String? = null, crossinline block : H1.() -> Unit = {}) : Unit = H1(attributesMapOf("class", classes), consumer).visit(block)
/** New overload: */
inline fun FlowOrHeadingContent.h1(params : Map<String, String> = null, crossinline block : H1.() -> Unit = {}) : Unit = H1(params, consumer).visit(block)
We can and have just manually inlined the current h1, but I think supporting more params in what seems to be the recommended API would be more correct.
This does not just apply to headings, but to many of the functions like this.
Specifically, we have needed to do this to allow setting id attributes for headings, which is used for tables of contents and to allow the headings to work as link anchors.
The
FlowOrHeadingContent.h1
method can acceptclass
as an argument, but not other parameters.In general, we want to pass through all or most parameters unchanged.
The ideal syntax that maintains back-compatability would likely be an overload
We can and have just manually inlined the current
h1
, but I think supporting more params in what seems to be the recommended API would be more correct.This does not just apply to headings, but to many of the functions like this.
Specifically, we have needed to do this to allow setting
id
attributes for headings, which is used for tables of contents and to allow the headings to work as link anchors.