Documentation
¶
Overview ¶
Package asset collects render-time asset references, accepts only publishable vault-relative file paths, excludes scan-skipped subtrees such as hidden paths, .obsidian, and node_modules, builds a single basename inventory over accepted regular non-symlink vault files, constrains outputs to assets/, reuses the pass-1 collision-aware destination plan when available, restores plain names for unique render-only assets, and copies only regular, non-symlink vault files with deterministic, case-safe output paths.
Index ¶
- func CandidatePaths(note *model.Note, attachmentFolderPath string, rawDestination string) []string
- func CopyAssetsWithReservedPaths(vaultRoot string, outputRoot string, assets map[string]*model.Asset, ...) error
- func HasImageExtension(value string) bool
- func IsPublishableAssetPath(value string) bool
- func VaultRelativePathCandidate(rawDestination string) string
- type AssetCollector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CandidatePaths ¶
CandidatePaths expands a destination into the ordered vault-relative candidates that pass 1 and pass 2 should probe.
func CopyAssetsWithReservedPaths ¶
func CopyAssetsWithReservedPaths(vaultRoot string, outputRoot string, assets map[string]*model.Asset, diagCollector *diag.Collector, reservedOutputPaths []string) error
CopyAssetsWithReservedPaths copies merged assets while preserving reserved output destinations for non-asset writers.
func HasImageExtension ¶
HasImageExtension reports whether the destination ends with a supported image extension.
func IsPublishableAssetPath ¶
IsPublishableAssetPath reports whether value is a vault-relative path that the asset pipeline accepts as a publishable input.
func VaultRelativePathCandidate ¶
VaultRelativePathCandidate returns an exact vault-relative path candidate for explicit destinations that already contain path segments.
Types ¶
type AssetCollector ¶
type AssetCollector struct {
// contains filtered or unexported fields
}
AssetCollector records pass-2 asset registrations and returns the site-relative output path that renderers should use in generated HTML.
func NewCollectorWithResourceFiles ¶
func NewCollectorWithResourceFiles(vaultRoot string, indexed map[string]*model.Asset, reservedOutputPaths []string, resourceFiles []string) (*AssetCollector, error)
NewCollectorWithResourceFiles creates a collector that optionally reuses a caller-provided emitted-resource inventory instead of walking the vault. Passing nil keeps collision planning scoped to indexed assets plus later pass-2 registrations.
func (*AssetCollector) PlanDestinations ¶
PlanDestinations expands requested sources through the collector's inventory-aware basename groups, updates the collector's cached plan, and returns destinations for the requested sources.
func (*AssetCollector) Register ¶
func (c *AssetCollector) Register(vaultRelPath string) string
Register records a vault-relative asset reference and returns the site-relative output path under assets/.