Skip to main content

Module document

Module document 

Source
Expand description

Markdown document parsing and rendering.

This module handles:

  • Parsing markdown with comrak
  • Extracting document structure (headings, links, images)
  • Rendering to styled lines for display

Structs§

Document
A parsed and rendered markdown document.
HeadingRef
Reference to a heading in the document.
ImageRef
Reference to an image in the document.
InlineColor
RGB color for inline styling.
InlineSpan
A styled inline span.
InlineStyle
Inline style flags for a text span.
LinkRef
Reference to a link in the document.
RenderedLine
A single rendered line with styling information.

Enums§

LineType
Type of a rendered line, used for styling.

Functions§

format_hex_dump
Format raw bytes as a hex dump in the classic hexdump -C style.
format_single_hex_line
Format a single 16-byte chunk as one hex dump line.
image_markdown
Generate markdown content that displays an image file inline.
is_binary
Returns true if the byte slice appears to be binary (non-text) content.
is_editable_file
Returns true if the file is a known text-editable format.
is_image_file
Returns true if the file extension is a recognized image format.
parse
Parse markdown source into a Document.
parse_with_image_heights
Parse markdown with known image heights (in terminal rows).
parse_with_layout
Parse markdown with layout width and image heights.
prepare_content
Prepare file content for rendering based on its extension.
prepare_content_from_bytes
Prepare file content from raw bytes, detecting binary vs text.
prepare_document_from_bytes
Prepare a Document directly from raw file bytes.