utils/markdown/markdown_utils
library
Functions
-
buildTableOfContents(String markdown, {int maxDepth = 3})
→ String
-
Build a table of contents from headings.
-
countWords(String markdown)
→ int
-
Count words in markdown content.
-
escapeMarkdown(String text)
→ String
-
Convert plain text to markdown-safe text (escape special chars).
-
estimateReadingTime(String markdown, {int wordsPerMinute = 200})
→ Duration
-
Estimate the reading time for markdown content.
-
Extract all code blocks from markdown text.
-
Extract all headings from markdown text.
-
Extract all links from markdown text.
-
formatAdmonition(String type, String content)
→ String
-
Format an admonition/callout.
-
formatChecklist(List<({bool checked, String text})> items)
→ String
-
Format a list of items as a markdown checklist.
-
formatCollapsible(String summary, String content)
→ String
-
Format a collapsible section (details/summary).
-
formatDefinitionList(Map<String, String> definitions)
→ String
-
Format key-value pairs as a markdown definition list.
-
formatDiffAsMarkdown(String diff, {String? title})
→ String
-
Format a diff as a markdown code block.
-
formatFileAsMarkdown(String content, {String? path, String? language})
→ String
-
Format a file's content as a markdown code block.
-
formatTable({required List<List<String>> rows, List<TableAlignment>? alignments})
→ String
-
Format data as a markdown table.
-
parseTable(String tableText)
→ ({List<String> headers, List<List<String>> rows})?
-
Parse a markdown table into headers and rows.
-
stripMarkdown(String markdown)
→ String
-
Strip all markdown formatting, returning plain text.
-
wordWrap(String text, {int maxWidth = 80})
→ String
-
Wrap text to a maximum line width.