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

marker

package
v0.9.16 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentChecksum

func ContentChecksum(content []byte) string

func LoadSectionTemplate

func LoadSectionTemplate(vaultPath, noteType, sectionKey string) ([]byte, error)

LoadSectionTemplate reads the section template file from .vaultmind/sections/{noteType}/{sectionKey}.md inside the vault. Returns MutationError{Code: "template_not_found"} if the file is absent.

func ReplaceRegion

func ReplaceRegion(raw []byte, sectionKey string, newContent []byte, force bool) ([]byte, error)

ReplaceRegion replaces the content between markers for a given section_key. Inserts a checksum comment after START. Returns checksum_mismatch error if hand-edited and force is false.

Types

type Issue

type Issue struct {
	SectionKey string `json:"section_key,omitempty"`
	Rule       string `json:"rule"`
	Message    string `json:"message"`
	Line       int    `json:"line"`
}

Issue represents a marker validation problem found in a file.

func ValidateMarkers

func ValidateMarkers(raw []byte) []Issue

ValidateMarkers inspects raw file bytes for marker problems and returns a slice of Issues. An empty slice means the file is clean.

type Marker

type Marker struct {
	SectionKey   string
	StartOffset  int
	EndOffset    int
	ContentStart int
	ContentEnd   int
	Checksum     string
	Content      string
}

Marker represents a detected generated region in a file.

func FindMarkers

func FindMarkers(raw []byte) ([]Marker, error)

type RenderConfig

type RenderConfig struct {
	VaultPath  string
	Target     string
	SectionKey string
	DryRun     bool
	Diff       bool
	Commit     bool
	Force      bool
	Detector   git.RepoStateDetector
	Checker    *git.PolicyChecker
	Committer  *git.Committer
}

RenderConfig configures the RenderRegion orchestrator.

type RenderResult

type RenderResult struct {
	Path            string                   `json:"path"`
	ID              string                   `json:"id"`
	SectionKey      string                   `json:"section_key"`
	Operation       string                   `json:"operation"`
	DryRun          bool                     `json:"dry_run"`
	Diff            string                   `json:"diff,omitempty"`
	WriteHash       string                   `json:"write_hash,omitempty"`
	Git             mutation.GitInfo         `json:"git"`
	ReindexRequired bool                     `json:"reindex_required"`
	Warnings        []mutation.PolicyWarning `json:"warnings"`
}

RenderResult is the response from RenderRegion.

func RenderRegion

func RenderRegion(cfg RenderConfig) (*RenderResult, error)

RenderRegion orchestrates the dataview region rendering pipeline:

  1. Read file from vault
  2. Extract note type from frontmatter
  3. Load section template from .vaultmind/sections/{type}/{key}.md
  4. Call ReplaceRegion to splice content
  5. Generate diff if requested
  6. If dry-run, return early
  7. Git policy check
  8. Conflict detection (re-read + hash compare)
  9. Atomic write (temp + rename + chmod)
  10. Return result

Jump to

Keyboard shortcuts

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