Documentation
¶
Overview ¶
Package mdparse provides goldmark-based helpers for inspecting markdown structure, used by the atomic-validate spec and config validators. Every function takes source bytes, so the package needs no filesystem access.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindTableByHeader ¶
FindTableByHeader locates the first table whose header cells exactly match the given titles in order, returning the header row's 1-indexed line.
func FindTableByRequiredColumns ¶
func FindTableByRequiredColumns(src []byte, required []string) (found bool, lineNumber int, err error)
FindTableByRequiredColumns is FindTableByHeader relaxed to an ordered subsequence: required titles must appear left to right, but extra columns between or after them are allowed.
func IsATXOnly ¶
IsATXOnly reports whether src contains no Setext headings.
Line prescan rather than AST inspection: goldmark exposes no "is setext" flag on Heading, and deriving line spans from segment offsets invites off-by-ones. Fenced blocks are skipped so embedded examples don't false-positive; indented blocks need no skip, since their leading space already fails isSetextUnderline.
Types ¶
type InlineRef ¶
type InlineRef struct {
Kind string // "code" | "link"
Text string // code-span inner text, or link destination
Line int // 1-indexed line number in source
}
InlineRef is a code span or link extracted from markdown prose (outside code blocks).
func InlineRefs ¶
InlineRefs collects code spans and links, skipping code-block subtrees.
type Section ¶
type Section struct {
Heading string
Level int
// Start is the heading's own 1-indexed line; End is the section's last
// line, or 0 when the section runs to the end of the file.
Start int
End int
}
Section describes a heading-bounded block in a markdown document.
type TextSegment ¶
TextSegment is a run of prose outside any code block. Line is its 1-indexed start; Text may span multiple lines.
func TextSegments ¶
func TextSegments(src []byte) []TextSegment
TextSegments extracts prose from src, skipping fenced and indented code blocks so the config validator's regexes don't match embedded examples.
Only block-level code is skipped: a pattern inside an inline `backtick span` still matches. Deliberate — such spans are rare for these patterns.