embedded

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package embedded scans standard markdown documents for cm/calcmark fenced code blocks and splits the input into passthrough and CalcMark segments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Segment

type Segment struct {
	Kind     SegmentKind
	Text     string // For Passthrough: the raw text (including newlines). For CalcMarkBlock: the block content (without fence lines).
	OpenLine int    // 1-based line number of the opening fence in the host document (0 for Passthrough).
}

Segment represents either passthrough markdown text or an extracted CalcMark block.

func Scan

func Scan(input string) []Segment

Scan finds cm/calcmark fenced code blocks in the input and returns segments. It performs a single-pass O(n) scan over lines.

type SegmentKind

type SegmentKind int

SegmentKind distinguishes passthrough text from CalcMark blocks.

const (
	// Passthrough represents markdown text that is not a CalcMark block.
	Passthrough SegmentKind = iota
	// CalcMarkBlock represents an extracted CalcMark fenced code block.
	CalcMarkBlock
)

Jump to

Keyboard shortcuts

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