Documentation
¶
Overview ¶
Package markdown provides MarkdownView — a read-only widget that renders a useful subset of CommonMark / GFM:
- ATX headings (#..######) with optional trailing #'s stripped
- Setext headings (text followed by === or ---)
- Paragraph text with **bold**, __bold__, *italic*, _italic_, `inline code`, ~~strikethrough~~, [link text](url), !image(url), <https://autolink>, <user@email.autolink>, and backslash escapes (\* \_ \\ etc.)
- Fenced code blocks (``` …) with optional language hint that is visually consumed (the fence lines themselves don't render)
- Indented code blocks (4+ leading spaces or a leading tab)
- Bullet lists with - / * / +
- Numbered lists (1. 2. 3.)
- Block quotes (> …, including the empty > line)
- Horizontal rules (--- / *** / ___)
- Tabs expanded to 4 spaces at line start
Inline markers are stripped from the visible output — "**bold**" renders as "bold" with the bold attribute, not the verbatim string.
Ported from MarkdownView.pas. The Pascal version uses a regex-driven pre-pass; this Go port is a hand-rolled line scanner.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alignment ¶
type Alignment int
Alignment is the column-alignment hint produced by table parsing.
type MarkdownView ¶
type MarkdownView struct {
views.Base
Top int
VScroll *views.ScrollBar
// contains filtered or unexported fields
}
MarkdownView is the read-only renderer.
func (*MarkdownView) GetTypeID ¶
func (m *MarkdownView) GetTypeID() string
GetTypeID for serial registry.
func (*MarkdownView) HandleEvent ¶
func (m *MarkdownView) HandleEvent(ev *drivers.Event)
HandleEvent dispatches:
- Mouse wheel: scroll
- Mouse-down + drag: select text; on release copy to clipboard via OSC 52 (same path the terminal widget uses)
- CmCopy: copy current selection
- Ctrl+A: select all
- Esc: clear selection
- Arrows / PgUp / PgDn / Home / End: scroll
func (*MarkdownView) SetMarkdown ¶
func (m *MarkdownView) SetMarkdown(md string)
SetMarkdown parses md and renders it into displayable lines.
Click to show internal directories.
Click to hide internal directories.