ipmtmeta

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ipmtmeta defines the ipmt processing-pipeline flag vocabulary and the `# ipmt:` first-line pragma, and reconciles the two carriers of that metadata:

  • a ```ipmt fence info-string ("```ipmt unresolved" → ["unresolved"]), extracted by pkg/markdown.FenceMeta; and
  • a `# ipmt:` first-non-empty-line comment inside the ipmt source, which is the ONLY channel available to standalone .ipmt files and <!-- ipm-include --> blocks (they have no fence).

The flags select how the block is PROCESSED (solver, embed). The negative- example `invalid` case is deliberately NOT a flag here — it is a separate fence language (```ipmt-invalid), skipped by every render tool.

Strictness (the design takes no backward-compatibility burden — tools and files upgrade together):

  • the pragma is valid ONLY on the first non-empty line; a pragma-shaped line anywhere else is an error (no silently-dead pragmas);
  • an unknown/malformed flag token (from the fence OR the pragma) is an error, not silently ignored.

Index

Constants

View Source
const (
	FlagUnresolved = "unresolved"
	FlagDefaults   = "defaults"
	FlagEmbedFalse = "embed=false"
)

Flag tokens. Bare tokens plus the one key=value token embed=false. `draft` (the lenient-authoring mode) is reserved but NOT registered until the mode ships — today it is rejected like any other unknown flag.

Variables

This section is empty.

Functions

func Contains

func Contains(meta []string, flag string) bool

Contains reports whether meta carries flag.

func EffectiveMeta

func EffectiveMeta(fenceTokens []string, content string) ([]string, error)

EffectiveMeta returns the validated, de-duplicated union of the fence-info tokens and the content pragma tokens (fence order first, then pragma). An unknown token from either source is an error.

func MetaFromContent

func MetaFromContent(content string) ([]string, error)

MetaFromContent extracts and validates the `# ipmt:` pragma tokens from ipmt source. It returns nil when there is no pragma. It errors if a pragma-shaped line is not the first non-empty line, or carries an unknown flag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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