Documentation
¶
Overview ¶
Package config reads the per-repo `.ipm.conf` file shared between cmd/md-embed, cmd/ipm-rpc, and any other infinite.pm Go toolchain entry point.
File format is a flat `key = value` INI dialect (no sections in v1). `#` starts a comment to end-of-line. Whitespace around the `=` and trailing spaces are ignored. Unknown keys are an error — they trip pre-commit / CI checks. To extend the schema, add a field to Config + a case in the parser; tests live next door.
Discovery walks upward from a starting directory looking for `.ipm.conf` or a `.git` marker; first match wins. This is the same shape as git-config's "repo root" discovery, so it composes cleanly with multi-root VS Code workspaces (one Config per workspace folder).
See the design rationale behind moving this out of pkg/mdembed.
Index ¶
Constants ¶
const FileName = ".ipm.conf"
FileName is the on-disk name of the per-repo config file.
Variables ¶
This section is empty.
Functions ¶
func FindRepoRoot ¶
FindRepoRoot walks upward from start, returning the first ancestor directory that contains either a `.git` entry or a .ipm.conf file. If neither is found before reaching the filesystem root, it returns start unchanged.
`.git` is recognized as either a directory (regular checkout) or a file (git worktree / submodule).
Types ¶
type Config ¶
type Config struct {
SVGDir *string
// EmbedIgnore is the list of glob patterns for `.md` files md-embed must
// skip entirely — never scanned, rendered, or rewritten. Use it for docs
// that contain illustrative or intentionally-invalid ipmt the tool would
// otherwise try to process (e.g. the md-embed tutorial, an "invalid
// examples" gallery).
//
// Set via one or more `embed-ignore = …` lines; each line is a comma- or
// whitespace-separated list of patterns and the lines accumulate. Patterns
// are matched against each file's path relative to the config's directory
// (forward slashes). Beyond filepath.Match's *, ?, [], a ** spans any
// number of path segments — so `docs/**/draft-*.md` matches at any depth
// under docs/, while `docs/*.md` matches only direct children.
EmbedIgnore []string
}
Config is the parsed contents of a .ipm.conf file. Only fields the file actually set are non-nil — that lets a caller distinguish "the file said `svg-dir = _ipm`" from "the file didn't mention svg-dir at all" when merging with CLI flag defaults.