Package-level declarations

Types

Link copied to clipboard
data class BlockStyle(val textStyle: TextStyle, val modifier: Modifier)
Link copied to clipboard
data class BoxStyle(val modifier: Modifier)
Link copied to clipboard
Link copied to clipboard
class DocumentParser(flexmarkParser: Parser, headerIdGenerator: HeaderIdGenerator)
Link copied to clipboard
@Immutable
data class DocumentStyles(val defaultFontFamily: FontFamily = FontFamily.Default, val blockShape: Shape = RoundedCornerShape(5.dp), val paragraph: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = 14.sp, letterSpacing = 0.5.sp, textAlign = TextAlign.Justify, lineHeight = 14.sp ), val h1: TextStyle = TextStyle( fontWeight = FontWeight.Light, fontSize = paragraph.fontSize * 3.5, letterSpacing = (-1.5).sp ), val h2: TextStyle = TextStyle( fontWeight = FontWeight.Light, fontSize = paragraph.fontSize * 3, letterSpacing = (-0.5).sp ), val h3: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = paragraph.fontSize * 2.5, letterSpacing = 0.sp ), val h4: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = paragraph.fontSize * 2, letterSpacing = 0.25.sp ), val h5: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontSize = paragraph.fontSize * 1.7, letterSpacing = 0.sp ), val h6: TextStyle = TextStyle( fontWeight = FontWeight.Medium, fontSize = paragraph.fontSize * 1.2, letterSpacing = 0.15.sp ), val listNumber: TextStyle = TextStyle( fontWeight = FontWeight.Bold, textAlign = TextAlign.Left ), val taskListCheckbox: BoxStyle = BoxStyle( modifier = Modifier.composed { padding(2.dp, 0.dp, 4.dp, 0.dp) .scale(0.8f) .pointerHoverIcon(PointerIcon.Hand) .size(with(LocalDensity.current) { paragraph.lineHeight.toDp() }) } ), val inlineCode: TextStyle = TextStyle( fontWeight = FontWeight.Normal, fontFamily = FontFamily.Monospace, background = Color.LightGray ), val codeBlock: BlockStyle = BlockStyle( textStyle = inlineCode.copy(background = Color.Transparent), modifier = Modifier .padding(15.dp) .border(Dp.Hairline, lerp(Color.LightGray, Color.Black, 0.1f), blockShape) .background(Color.LightGray, blockShape) .padding(10.dp, 5.dp) ), val blockQuote: BoxStyle = BoxStyle( modifier = Modifier .padding(15.dp) .border(Dp.Hairline, lerp(Color.LightGray, Color.Black, 0.1f), blockShape) .background(Color.Black.copy(alpha = 0.2f), blockShape) .clip(blockShape) .leftBorder(5.dp, lerp(Color.LightGray, Color.Black, 0.2f)) .padding(10.dp, 5.dp) ), val table: TableStyle = TableStyle( headerCellStyle = BlockStyle( textStyle = paragraph, modifier = Modifier .background(Color.LightGray) .leftBorder(Dp.Hairline, Color.Gray) .padding(8.dp) ), bodyCellStyle = BlockStyle( textStyle = paragraph, modifier = Modifier .leftBorder(Dp.Hairline, Color.LightGray) .topBorder(Dp.Hairline, Color.LightGray) .padding(8.dp) ), modifier = Modifier .fillMaxWidth() .padding(16.dp) .clip(blockShape) .border(Dp.Hairline, lerp(Color.LightGray, Color.Black, 0.1f), blockShape) ), val link: TextStyle = TextStyle( color = Color.Blue, textDecoration = TextDecoration.Underline ), val inlineAnchor: TextStyle = TextStyle( fontWeight = FontWeight.Bold, textDecoration = TextDecoration.Underline ), val deadLink: TextStyle = TextStyle( color = Color.Red, textDecoration = TextDecoration.Underline ), val emphasis: TextStyle = TextStyle( fontStyle = FontStyle.Italic ), val strong: TextStyle = TextStyle( fontWeight = FontWeight.Bold ), val strikethrough: TextStyle = TextStyle( textDecoration = TextDecoration.LineThrough ), val selection: SelectionStyle = SelectionStyle( fillColor = Color.Cyan.copy(alpha = 0.3f), stroke = SelectionStyle.Stroke( width = 2.dp, color = Color.Cyan ) ), val userMention: TextStyle = TextStyle( background = Color(0xffc1e7fe), fontWeight = FontWeight.Bold ), val image: ImageStyle = ImageStyle( modifier = Modifier .clip(blockShape) .border(Dp.Hairline, lerp(Color.LightGray, Color.Black, 0.1f), blockShape), title = BlockStyle( textStyle = paragraph.copy(textAlign = TextAlign.Center), modifier = Modifier .fillMaxWidth(1.0f) .background(Color.White.copy(alpha = 0.5f)) .padding(4.dp) ) ))
Link copied to clipboard
@Immutable
class DocumentTheme(val styles: DocumentStyles = DocumentStyles(), val lineStyle: BorderStroke = BorderStroke(1.dp, Color.Black))
Link copied to clipboard
data class ImageStyle(val modifier: Modifier, val title: BlockStyle)
Link copied to clipboard
interface LinkHandler
Link copied to clipboard
data class MappedText(val text: AnnotatedString, val textMapping: TextMapping, val inlineContent: Map<String, InlineTextContent> = emptyMap())

Text, which carries information about what part of source text it came from.

Link copied to clipboard
class MarkdownDocument(val sourceText: String, val ast: Document, val basePath: Path, references: Map<String, MarkdownReference>, interactiveIdGenerator: LinearInteractiveIdGenerator = LinearInteractiveIdGenerator(), interactiveIds: Map<Node, InteractiveId> = generateInteractiveIdsPreOrder( ast, interactiveIdGenerator ))
Link copied to clipboard
data class MarkdownReference(val name: String, val url: String, val title: String?)
Link copied to clipboard
data class TableStyle(val headerCellStyle: BlockStyle, val bodyCellStyle: BlockStyle, val modifier: Modifier)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun Renderers.Companion.flexmarkDefault(codeFenceRenderers: List<CodeFenceRenderer> = emptyList()): Renderers<Node>
Link copied to clipboard
fun Modifier.leftBorder(strokeWidth: Dp, color: Color): Modifier
Link copied to clipboard
@Composable
fun MarkdownEditor(editorState: WysiwygEditorState, documentTheme: DocumentTheme, autocompletePlugins: List<AutocompletePlugin> = listOf(EmojiAutocompletePlugin()), onChange: (newEditorState: WysiwygEditorState) -> Unit)
Link copied to clipboard
@Composable
fun MarkdownView(sourceText: String, basePath: Path, modifier: Modifier = Modifier.fillMaxWidth(1f), documentTheme: DocumentTheme = DocumentTheme.default, scrollable: Boolean = true, codeFenceRenderers: List<CodeFenceRenderer> = emptyList(), linkHandlers: List<LinkHandler> = emptyList(), renderers: Renderers<Node> = Renderers.flexmarkDefault( codeFenceRenderers ))

Renders a Markdown document nicely.

Link copied to clipboard
fun Modifier.topBorder(strokeWidth: Dp, color: Color): Modifier