mdtext

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mdtext converts light Markdown into the two forms OpenPanda's surfaces need beyond a rendered web page:

  • Plain: readable prose for TTS (the voice pipeline) and for pipes / logs — emphasis markers, link syntax and fence markers are dropped, table rows become comma-separated values.
  • ANSI: a terminal-friendly render for TTYs — headings become bold cyan, bold/italic/code keep their emphasis via SGR, tables stay column-aligned.

It is a small line-oriented state machine, not a full Markdown parser: model answers are light Markdown (headings, lists, tables, fenced code, emphasis), and the goal is that nothing reads worse than it would as raw text. A gofmt-style fenced block passes through untouched (plain) or dim (ANSI); anything unrecognized is kept verbatim.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ANSI

func ANSI(s string) string

ANSI renders Markdown with SGR emphasis for color TTYs: headings bold cyan, fenced code dim, bold→bold, code→dim, italic→italic, tables column-aligned, lists and quotes kept. When the caller already knows the sink is not a TTY it should use Plain instead.

func IsFenceStart

func IsFenceStart(line string) bool

IsFenceStart reports whether a line opens or closes a fenced code block (``` markers); streaming line renderers track fence state with this and pass lines through untouched inside a fence.

func LineANSI

func LineANSI(line string, fence bool) string

LineANSI renders one Markdown line with SGR emphasis (see ANSI). fence selects code-block pass-through. It is stateless so a stream can render line by line as deltas arrive.

func LinePlain

func LinePlain(line string, fence bool) string

LinePlain renders one Markdown line as plain text (see Plain). fence selects code-block pass-through.

func Plain

func Plain(s string) string

Plain strips Markdown syntax for speech and plain-text sinks: headings keep their text, emphasis and link markers drop out, fenced code stays verbatim, tables flatten to comma-separated cells, list bullets become "• " and horizontal rules become "—".

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL