Rafael Tonholo
08/02/2025, 9:32 PM{{{ start .some.package.CustomComponent }}}
## My subtitle
**bunch** of text with *different* ~styles~
{{{ end .some.package.CustomComponent }}}
Rest of the markdown file
Composable:
@Composable
fun CustomComponent(content: @Composable () -> Unit) {
Div(attrs = CustomComponentStyle.toAttrs()) {
// other custom stuff
content()
}
}
And in the generated file, it would call the custom component something like this:
@Page("/awesome-markdown")
@Layout(".MarkdownLayout")
@Composable
fun Awesome_markdown() {
project.some.package.CustomComponent {
org.jetbrains.compose.web.dom.P {
org.jetbrains.compose.web.dom.B {
org.jetbrains.compose.web.dom.Text("bunch")
}
org.jetbrains.compose.web.dom.Text(" of text with ")
org.jetbrains.compose.web.dom.Em {
org.jetbrains.compose.web.dom.Text("different")
}
org.jetbrains.compose.web.dom.Text(" ~styles~")
}
}
// Rest of the markdown file parsed
}
Would that be possible?David Herman
08/02/2025, 9:32 PMDavid Herman
08/02/2025, 9:33 PMDavid Herman
08/02/2025, 9:34 PMRafael Tonholo
08/02/2025, 9:36 PMKotlinText("Kotlin")
, except it should accept the markdown content instead...
That would enable the custom component to render part of the content using the markdown style, like if it was a wrapper of somethingDavid Herman
08/02/2025, 9:38 PMRafael Tonholo
08/02/2025, 9:38 PMDavid Herman
08/02/2025, 9:39 PMDavid Herman
08/02/2025, 9:39 PMRafael Tonholo
08/02/2025, 9:43 PMDavid Herman
08/02/2025, 9:44 PMRafael Tonholo
08/02/2025, 9:45 PM{{{ .CustomComponent
First paragraph
Second paragraph
}}}
The compiler returns this:
1: Execution failed for task ':site:kobwebxMarkdownConvert'.
> Cannot invoke "org.commonmark.node.SourceSpan.getColumnIndex()" because the return value of "org.commonmark.parser.SourceLine.getSourceSpan()" is null
And it generates correctly once I remove the empty line between first and second paragraphsDavid Herman
08/02/2025, 9:46 PMRafael Tonholo
08/02/2025, 9:46 PM{{{ .CustomComponent
First paragraph
Second paragraph
}}}
Has the same compilation errorRafael Tonholo
08/02/2025, 9:47 PMDavid Herman
08/02/2025, 9:47 PMRafael Tonholo
08/02/2025, 9:47 PMDavid Herman
08/02/2025, 9:47 PM{{{ ...
<p>First
<p>Second
}}}
Rafael Tonholo
08/02/2025, 9:48 PM<p>
before the paragraph line works, but it breaks all the other styles from the Markdown...David Herman
08/02/2025, 9:51 PMDavid Herman
08/02/2025, 9:51 PMRafael Tonholo
08/02/2025, 10:02 PMRafael Tonholo
08/02/2025, 10:04 PMRafael Tonholo
08/02/2025, 10:16 PMDavid Herman
08/02/2025, 10:17 PMRafael Tonholo
08/03/2025, 12:01 AMDavid Herman
08/03/2025, 1:31 AMDavid Herman
08/03/2025, 1:32 AMDavid Herman
08/03/2025, 1:32 AM