markdown

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCatppuccinStyles

func RegisterCatppuccinStyles()

RegisterCatppuccinStyles registers the Catppuccin color themes

Types

type Line

type Line struct {
	Content     string
	Type        LineType
	HeaderLevel int
	CodeLang    string
}

Line represents a single line in the markdown content with metadata

type LineType

type LineType int
const (
	LineTypeNormal LineType = iota
	LineTypeHeader
	LineTypeCodeFence
	LineTypeCode
	LineTypeEmpty
	LineTypeComment
)

type Model

type Model struct {
	Content       string
	Width         int
	Lines         []Line
	LineNumbers   bool
	Style         string // Name of the Chroma style to use
	ChromaStyle   *chroma.Style
	DefaultLexer  string // Default lexer to use when language is not specified
	TerminalTheme string // Terminal theme: "dark" or "light"
}

func New

func New(content string, width int) Model

New creates a new markdown model

func (*Model) ParseLines

func (m *Model) ParseLines()

ParseLines parses the content into individual lines with metadata

func (*Model) Render

func (m *Model) Render() string

Render renders the markdown content

func (*Model) RenderPreservingAll

func (m *Model) RenderPreservingAll() string

RenderPreservingAll renders the markdown content preserving every line

func (*Model) SetCatppuccinTheme

func (m *Model) SetCatppuccinTheme(mode string)

SetCatppuccinTheme sets the Catppuccin theme based on the provided mode mode can be "dark" or "light"

func (*Model) SetLineNumbers

func (m *Model) SetLineNumbers(show bool)

func (*Model) SetStyle

func (m *Model) SetStyle(styleName string)

func (*Model) SetTerminalTheme

func (m *Model) SetTerminalTheme(theme string)

SetTerminalTheme sets the terminal theme (dark or light)

Jump to

Keyboard shortcuts

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