export

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package export renders the module graph and the symbol graph into formats other tools read: GraphML, Cypher, JSON, DOT, Mermaid, an Obsidian vault and a token-budgeted markdown wiki. Output is deterministic.

Index

Constants

View Source
const (
	ScopeModules = "modules"
	ScopeSymbols = "symbols"
)

Scope picks which graph a single-file format renders.

Variables

View Source
var Formats = []string{"graphml", "cypher", "json", "dot", "mermaid", "obsidian", "markdown-wiki"}

Formats lists every supported format name.

Functions

func WriteStdout

func WriteStdout(w interface{ Write([]byte) (int, error) }, files []File) error

WriteStdout prints files, with a marker line between files when there are several.

func WriteTo

func WriteTo(out string, files []File) ([]string, error)

WriteTo writes files under out. A single file may target a plain file path; otherwise out is a directory that is created when missing.

Types

type Edge

type Edge struct {
	From  string  `json:"from"`
	To    string  `json:"to"`
	Kind  string  `json:"kind"`
	Conf  string  `json:"confidence,omitempty"`
	Score float64 `json:"score,omitempty"`
}

Edge is the shared edge shape for all graph formats.

type File

type File struct {
	Name    string
	Content string
}

File is one rendered output file with a slash-separated relative name.

func Render

func Render(format string, in Input, o Options) ([]File, error)

Render turns the input into one or more files for the given format.

type Input

type Input struct {
	Index *schema.Index
	Graph *graph.SymGraph
}

Input is everything a renderer may use. Graph may be nil.

type Model

type Model struct {
	Scope string `json:"scope"`
	Nodes []Node `json:"nodes"`
	Edges []Edge `json:"edges"`
}

Model is a flattened graph.

type Node

type Node struct {
	ID    string `json:"id"`
	Label string `json:"label"`
	Kind  string `json:"kind"`
	File  string `json:"source_file,omitempty"`
	Line  int    `json:"line,omitempty"`
	Group string `json:"group,omitempty"`
}

Node is the shared node shape for all graph formats.

type Options

type Options struct {
	Scope      string // ScopeModules or ScopeSymbols; empty picks symbols when a graph is present
	PageTokens int    // markdown-wiki per page budget in tokens; 0 reads STACKLIT_EXPORT_PAGE_TOKENS
	MaxNodes   int    // dot and mermaid node cap; 0 reads STACKLIT_EXPORT_MAX_NODES
}

Options tunes rendering.

Jump to

Keyboard shortcuts

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