MarkdownContext
Various context that will be set if this page was generated from Markdown.
To access it, use rememberPageContext in your composable and read the markdown field.
In other words, if you had Markdown like this, which called a Signature widget:
# Markdown.md
---
author: BitSpittle
date: 12-31-1999
---
... a bunch of content ...
{{ Signature() }}Content copied to clipboard
then you might implement Signature like so:
// Signature.kt
@Composable
fun Signature() {
val ctx = rememberPageContext()
val markdown = ctx.markdown!! // Will be null if this composable was not called from within a markdown file
// Markdown front matter value can be a list of strings, but here it's only a single one
val author = markdown.frontMatter.getValue("author").single()
Text("Article by $author")
}Content copied to clipboard