Documentation
¶
Overview ¶
Package codeblock provides markdown code block parsing and extraction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectLanguage ¶
DetectLanguage determines the language identifier for a file path.
Types ¶
type CodeBlock ¶
type CodeBlock struct {
Language string `json:"language"` // From fence (python, bash, etc.)
Content string `json:"content"` // The code itself
StartLine int `json:"start_line"` // Line number in source
EndLine int `json:"end_line"` // Ending line number
FilePath string `json:"file_path,omitempty"` // Detected file path (if any)
IsNew bool `json:"is_new,omitempty"` // Appears to be new file vs modification
SourcePane string `json:"source_pane,omitempty"` // Pane ID where block was found
}
CodeBlock represents a single code block extracted from markdown.
func ExtractFromText ¶
ExtractFromText is a convenience function to extract code blocks from text.
func ExtractWithFilter ¶
ExtractWithFilter extracts code blocks filtered by language.
type Extraction ¶
type Extraction struct {
Source string `json:"source"` // Session/pane identifier
Blocks []CodeBlock `json:"blocks"` // Extracted code blocks
TotalLines int `json:"total_lines"` // Total lines in source
}
Extraction contains all code blocks from a source.
type Parser ¶
type Parser struct {
// Options for parsing
LanguageFilter []string // Only extract blocks with these languages (empty = all)
}
Parser extracts code blocks from text.
func (*Parser) WithLanguageFilter ¶
WithLanguageFilter sets languages to filter for.
Click to show internal directories.
Click to hide internal directories.