Documentation
¶
Index ¶
- Constants
- func HasTableCellBreaks(markdown string) bool
- func HeadingNormalizedText(text string) string
- func IsHeadingElement(t MarkdownElementType) bool
- func IsTableSeparator(line string) bool
- func NormalizeTablesForDriveImport(markdown string) string
- func ParseTableRow(line string) []string
- func StripElementHeadingAnchors(elements []MarkdownElement)
- func StripHeadingAnchors(markdown string) string
- type ExplicitHeadingAnchor
- type MarkdownElement
- type MarkdownElementType
- type TableData
- type TextStyle
Constants ¶
const SoftLineBreak = "\v"
SoftLineBreak is the Google Docs InsertText character for a line break inside the current paragraph. Live Docs API readback returns it inside the same textRun, which lets fenced code blocks keep one shaded paragraph.
Variables ¶
This section is empty.
Functions ¶
func HasTableCellBreaks ¶
HasTableCellBreaks reports whether a Markdown table contains HTML line breaks.
func HeadingNormalizedText ¶
HeadingNormalizedText collapses heading whitespace for stable matching.
func IsHeadingElement ¶
func IsHeadingElement(t MarkdownElementType) bool
IsHeadingElement reports whether an element is a heading.
func IsTableSeparator ¶
IsTableSeparator checks if a line is a markdown table separator (|---|---|).
func NormalizeTablesForDriveImport ¶
NormalizeTablesForDriveImport ensures Drive conversion receives non-empty table headers.
func ParseTableRow ¶
ParseTableRow parses a single table row into cells.
func StripElementHeadingAnchors ¶
func StripElementHeadingAnchors(elements []MarkdownElement)
StripElementHeadingAnchors removes explicit anchors from parsed heading content.
func StripHeadingAnchors ¶
StripHeadingAnchors removes explicit heading anchors outside code fences.
Types ¶
type ExplicitHeadingAnchor ¶
ExplicitHeadingAnchor identifies one source heading and its explicit anchor.
func ExplicitHeadingAnchors ¶
func ExplicitHeadingAnchors(markdown string) []ExplicitHeadingAnchor
ExplicitHeadingAnchors returns explicit anchors from parsed Markdown headings.
func ImportExplicitHeadingAnchors ¶
func ImportExplicitHeadingAnchors(markdown string) []ExplicitHeadingAnchor
ImportExplicitHeadingAnchors returns anchors in Drive import heading order.
type MarkdownElement ¶
type MarkdownElement struct {
Type MarkdownElementType
Content string
Anchor string // for headings: explicit Pandoc-style {#id}
Children []MarkdownElement
URL string // for links
Level int // for headings and lists
TableCells [][]string // for tables: rows of cells
}
MarkdownElement represents a parsed markdown element
func ParseMarkdown ¶
func ParseMarkdown(text string) []MarkdownElement
ParseMarkdown parses markdown text into structured elements
type MarkdownElementType ¶
type MarkdownElementType int
MarkdownElementType represents the type of markdown element
const ( MDText MarkdownElementType = iota MDHeading1 MDHeading2 MDHeading3 MDHeading4 MDHeading5 MDHeading6 MDBold MDItalic MDBoldItalic MDCode MDCodeBlock MDLink MDImage MDListItem MDNumberedList MDBlockquote MDHorizontalRule MDParagraph MDEmptyLine MDTable )
type TableData ¶
TableData represents a table to be inserted natively
func MarkdownToDocsRequests ¶
func MarkdownToDocsRequests(elements []MarkdownElement, baseIndex int64, tabID string) ([]*docs.Request, string, []TableData)
MarkdownToDocsRequests converts parsed markdown elements to Google Docs batch update requests. baseIndex is the insertion location in the document. Returns: requests, plainText, tableData (for native table insertion)
type TextStyle ¶
type TextStyle struct {
Bold bool
Italic bool
Strikethrough bool
Code bool
Link string
Start int64
End int64
}
TextStyle represents text formatting
func ParseInlineFormatting ¶
ParseInlineFormatting parses inline markdown formatting within text Returns styles with indices relative to the stripped plain text (UTF-16 code units)