# mbtui
`mbtui` renders `mbdown` documents directly to native Ratatui text and media
placements. It supports
Unicode-aware layout, tables, syntax-highlighted code blocks, semantic styles,
hashtags, wikilinks, file embeds, inline math, terminal-native display math, boxes, and
responsive columns without an ANSI round trip. Invalid or over-wide formulas
fall back to a `tex` source block. The default `Theme` uses the Catppuccin Mocha
palette.
`Renderer::render` returns `RenderedDocument`: its `text` contains stable blank
rows reserved for CommonMark images, while `images` describes each source, alt
text, and terminal-cell rectangle after Box, alignment, indentation, and column
layout. Its owned `front_matter` field exposes parsed YAML/TOML source and its
original byte span even though front matter is hidden from `text` by default.
Use `Renderer::with_front_matter(true)` to render it as a labeled metadata
block. Applications own image loading and terminal-protocol rendering.
The `semantics` field reports each Hashtag, WikiLink, and non-image Embed with its document-level
source span and one or more terminal-cell regions. Regions already include
wrapping and Box, alignment, indentation, padding, table, and column offsets,
so downstream applications can add interaction without inferring meaning from
colors or reparsing rendered text.
Bordered boxes and table outer corners can use square or rounded glyphs:
```rust
use mbtui::{CornerStyle, Renderer, Theme};
let theme = Theme::default().with_corner_style(CornerStyle::Rounded);
let rendered = Renderer::with_theme(80, theme)
.with_image_height(12)
.render(&mbdown::parse("")?);
assert_eq!(rendered.images[0].height, 12);
# Ok::<(), Box<dyn std::error::Error>>(())
```
See the [MBDown 0.1 Language Specification](https://github.com/FrostMiKu/mbdown/blob/main/docs/language-specification.md)
for the core language and its backend-neutral syntax tree.