processImage
fun NodeScope.processImage(image: Image, output: (MarkdownHandlers.ImageData) -> String): String(source)
Helper function to process an Image node, passing information to a callback to generate the final output.
Users can override the img
handler like so:
kobweb {
markdown {
handlers {
img.set {
processImage(it) { data ->
"com.myproject.components.widgets.ImageWidget(\"${data.destination}\", \"${data.altText}\")"
}
}
}
}
}
Content copied to clipboard
Users can of course process the Image node directly, but they should know that it carries its alt text as children nodes, which this logic abstracts away.