markdown

package
v0.30.13 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 9 Imported by: 1 module, 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 markdown provides a channel-agnostic pipeline for adapting LLM markdown output to chat platforms that don't render every GFM construct.

Today it focuses on tables: Discord and Telegram both ignore GFM table syntax, so raw `| col | col |` lines render as a wall of pipe characters. ConvertTables parses the input with goldmark (AST, not regex), locates table nodes, and rewrites them according to the configured TableMode.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertTables

func ConvertTables(input string, mode TableMode) string

ConvertTables rewrites GFM tables in `input` according to `mode`. Non-table content is returned verbatim — line endings, code blocks, indentation, and trailing whitespace are preserved.

Types

type TableMode

type TableMode string

TableMode controls how GFM tables are rewritten before being sent to a chat platform.

const (
	// TableModeCode wraps each table in a fenced “` block with column-aligned
	// monospace text so chat clients render it readably.
	TableModeCode TableMode = "code"
	// TableModeBullets converts each row into a bullet list of "Header: Value" pairs.
	TableModeBullets TableMode = "bullets"
	// TableModeOff disables conversion; the original text is returned unchanged.
	TableModeOff TableMode = "off"
)

func ParseMode

func ParseMode(s string) TableMode

ParseMode parses a TOML / config string into a TableMode, defaulting to TableModeCode when the input is empty or unrecognized.

Jump to

Keyboard shortcuts

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