Documentation
¶
Index ¶
- func DetectFileType(path string) string
- func IsBinary(content []byte) bool
- func IsValidUTF8(content []byte) bool
- func StripBOM(content []byte) []byte
- func StripFrontmatter(content []byte) ([]byte, string, string)
- type ComponentType
- type Export
- type Heading
- type MDXParser
- type MarkdownParser
- type Outline
- type OutlineType
- type ParseResult
- type Parser
- type TextParser
- type TypeScriptParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectFileType ¶
DetectFileType maps file extension to type string. Returns: "md", "mdx", "txt", "tsx", "ts", or "unknown".
func IsValidUTF8 ¶
IsValidUTF8 validates the content is valid UTF-8.
Types ¶
type ComponentType ¶
type ComponentType string
const ( ComponentTypeDocumentation ComponentType = "documentation" ComponentTypeCode ComponentType = "code" ComponentTypeNone ComponentType = "" )
type MDXParser ¶
type MDXParser struct {
// contains filtered or unexported fields
}
func NewMDXParser ¶
func NewMDXParser() *MDXParser
type MarkdownParser ¶
type MarkdownParser struct{}
func NewMarkdownParser ¶
func NewMarkdownParser() *MarkdownParser
func (*MarkdownParser) CanParse ¶
func (p *MarkdownParser) CanParse(path string) bool
func (*MarkdownParser) Parse ¶
func (p *MarkdownParser) Parse(_ string, content []byte) (*ParseResult, error)
type Outline ¶
type Outline struct {
Type OutlineType `json:"type"`
Headings []Heading `json:"headings,omitempty"`
Exports []Export `json:"exports,omitempty"`
}
type OutlineType ¶
type OutlineType string
const ( OutlineTypeHeadings OutlineType = "headings" OutlineTypeExports OutlineType = "exports" OutlineTypeNone OutlineType = "none" )
type ParseResult ¶
type ParseResult struct {
Description string
ComponentType ComponentType
Outline *Outline
Lines int
}
type Parser ¶
type Parser interface {
Parse(path string, content []byte) (*ParseResult, error)
CanParse(path string) bool
}
Parser extracts description and outline from file content.
type TextParser ¶
type TextParser struct{}
func NewTextParser ¶
func NewTextParser() *TextParser
func (*TextParser) CanParse ¶
func (p *TextParser) CanParse(path string) bool
func (*TextParser) Parse ¶
func (p *TextParser) Parse(_ string, content []byte) (*ParseResult, error)
type TypeScriptParser ¶
type TypeScriptParser struct{}
func NewTypeScriptParser ¶
func NewTypeScriptParser() *TypeScriptParser
func (*TypeScriptParser) CanParse ¶
func (p *TypeScriptParser) CanParse(path string) bool
func (*TypeScriptParser) Parse ¶
func (p *TypeScriptParser) Parse(_ string, content []byte) (*ParseResult, error)
Click to show internal directories.
Click to hide internal directories.