Go port of day50-dev/render-markdown-terminal (Streamdown): renders markdown streams into ANSI-coloured terminal text with incremental streaming output (render tokens as the LLM emits them).
import "github.com/holihur/streamdown"
r, _ := streamdown.New(os.Stdout) // default palette & layout; zero-value Config is fully defaulted
r.RenderString(markdown) // or r.Render(io.Reader) for streaming input
r.Tidyup() // finish: reset terminal, optional OSC 52 clipboardFeature parity with the upstream Python implementation: HSV-derived true-colour palette, CJK-aware wrapping (width table byte-identical to Python wcwidth), tables, lists (nested), blockquotes, headings (ATX + setext), horizontal rules, code blocks (fenced and 4-space indent, chroma syntax highlighting), inline styles (bold/italic/strike/underline/inline code/superscript footnotes), and OSC 8 hyperlinks.
Differences: Config zero value is safe (see DefaultConfig() in the package
docs); PlainBackground is on by default (code blocks/tables/inline code use
the terminal default background instead of painting theme-colour backgrounds
with ▄/▀ pads — set PlainBackground=false for the upstream look); syntax
highlighting uses chroma instead of pygments (colours differ, structure is the
same); the inline image protocol is not supported, images fall back to alt text.
tools/genwidth.py regenerates width_table.go from the Unicode data.
go test ./...