Help us shape the future of Go! Take the 2026 Go Developer Survey

markdown

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package markdown provides Markdown/text extraction for knowledge graphs. It extracts documentation concepts that can be linked to code entities.

Index

Constants

View Source
const (
	// Language is the canonical name for Markdown.
	Language = "markdown"

	// NodePrefix is the prefix for all Markdown node IDs.
	NodePrefix = "doc_"
)
View Source
const (
	EdgeTypeDocuments = "documents" // Doc concept documents code entity
	EdgeTypeDescribes = "describes" // Doc describes behavior/architecture
	EdgeTypeExplains  = "explains"  // Doc provides design rationale
)

Semantic edge types for documentation relationships.

Variables

This section is empty.

Functions

func CollectDocFiles

func CollectDocFiles(dir string, skipDirs []string) ([]string, error)

CollectDocFiles walks a directory and returns all documentation files.

func ScanDocFile

func ScanDocFile(path string) (*bufio.Scanner, *os.File, error)

ScanDocFile reads a doc file and returns a line scanner.

Types

type CodeRef

type CodeRef struct {
	Target   string // Target node ID
	EdgeType string // documents, describes, explains
	Reason   string // Why this reference exists
}

CodeRef represents a reference to code from documentation.

type Concept

type Concept struct {
	Title    string
	Level    int    // Heading level (1-6)
	Content  string // Text content under this heading
	CodeRefs []CodeRef
}

Concept represents a documentation concept extracted from Markdown.

type DocFile

type DocFile struct {
	Path   string `json:"path"`
	Tokens int    `json:"tokens"`
	Type   string `json:"type"`
}

DocFile represents a documentation file with metadata.

func ReadDocFiles

func ReadDocFiles(dir string) ([]DocFile, error)

ReadDocFiles reads documentation files and returns their paths and estimated tokens.

type Extractor

type Extractor struct{}

Extractor implements provider.LanguageExtractor for Markdown files.

func New

func New() *Extractor

New creates a new Markdown extractor.

func (*Extractor) CanExtract

func (e *Extractor) CanExtract(path string) bool

CanExtract returns true for Markdown/text files.

func (*Extractor) DetectFramework

func (e *Extractor) DetectFramework(path string) *provider.FrameworkInfo

DetectFramework returns nil for Markdown files (no framework detection).

func (*Extractor) Extensions

func (e *Extractor) Extensions() []string

Extensions returns Markdown file extensions.

func (*Extractor) ExtractFile

func (e *Extractor) ExtractFile(path, baseDir string) ([]*graph.Node, []*graph.Edge, error)

ExtractFile extracts nodes and edges from a Markdown file.

func (*Extractor) Language

func (e *Extractor) Language() string

Language returns "markdown".

Jump to

Keyboard shortcuts

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