tree

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package tree builds hierarchical navigation trees from markdown file directories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Modified     time.Time          `json:"modified"`
	Metadata     *renderer.Metadata `json:"metadata,omitempty"`
	Name         string             `json:"name"`
	RawName      string             `json:"rawName"`
	RelativePath string             `json:"relativePath"`
	Slug         string             `json:"slug"`
	Type         NodeType           `json:"type"`
	Title        string             `json:"title"`
	Children     []*Node            `json:"children,omitempty"`
	Size         int64              `json:"size"`
}

Node represents a navigation entry (directory or markdown file).

func Build

func Build(ctx context.Context, root string, opts Options) (*Node, error)

Build walks the root directory and returns a tree of markdown content.

type NodeType

type NodeType string

NodeType identifies what a tree node represents.

const (
	NodeTypeDirectory NodeType = "directory"
	NodeTypeFile      NodeType = "file"
)

Node type constants for directory and file entries.

type Options

type Options struct {
	Renderer      *renderer.Service
	ExcludeDirs   []string
	IncludeHidden bool
}

Options control how the tree is constructed.

Jump to

Keyboard shortcuts

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