assets

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ManifestSchemaVersion = "pinax.assets.v1"

Variables

This section is empty.

Functions

func DisplayPath

func DisplayPath(req PathDisplayRequest) (string, error)

func PlaceAttachment

func PlaceAttachment(req AttachmentPlacementRequest) (string, error)

func Save

func Save(root string, manifest Manifest) error

func Validate

func Validate(manifest Manifest) error

Types

type AddMode

type AddMode string
const (
	AddModeCopy     AddMode = "copy"
	AddModeRegister AddMode = "register"
)

type AddOptions

type AddOptions struct {
	Mode     AddMode
	ObjectID string
}

type Asset

type Asset = domain.Asset

func Add

func Add(root, source string) (Asset, error)

func AddWithOptions

func AddWithOptions(root, source string, opts AddOptions) (Asset, error)

func Find

func Find(root, ref string) (Asset, error)
type AssetLink = domain.AssetLink
func ExtractLinks(req LinkExtractionRequest) []AssetLink

ExtractLinks parses local non-Markdown attachment references without rewriting the note body.

type AttachmentPlacementPolicy

type AttachmentPlacementPolicy string
const (
	AttachmentPlacementPerNote     AttachmentPlacementPolicy = "per-note"
	AttachmentPlacementVaultFolder AttachmentPlacementPolicy = "vault-folder"
	AttachmentPlacementNoteFolder  AttachmentPlacementPolicy = "note-folder"
)

type AttachmentPlacementRequest

type AttachmentPlacementRequest struct {
	Root     string
	NoteID   string
	NotePath string
	Filename string
	Policy   AttachmentPlacementPolicy
}

type EmbeddedAssetPreview

type EmbeddedAssetPreview struct {
	Path       string `json:"path"`
	MediaType  string `json:"media_type"`
	RenderMode string `json:"render_mode"`
	ByteCount  int    `json:"byte_count"`
	Status     string `json:"status"`
	Truncated  bool   `json:"truncated,omitempty"`
	Warning    string `json:"warning,omitempty"`
}

type LinkExtractionRequest

type LinkExtractionRequest struct {
	SourceNoteID string
	SourcePath   string
	Body         string
}

LinkExtractionRequest describes a single Markdown note body to scan for asset references.

type Manifest

type Manifest = domain.AssetManifest

func Load

func Load(root string) (Manifest, error)

type PathDisplayRequest

type PathDisplayRequest struct {
	Root            string
	AssetPath       string
	ContextNotePath string
	MediaType       string
	Label           string
	Style           PathDisplayStyle
}

type PathDisplayStyle

type PathDisplayStyle string
const (
	PathStyleVaultRelative PathDisplayStyle = "vault-relative"
	PathStyleNoteRelative  PathDisplayStyle = "note-relative"
	PathStyleAbsolute      PathDisplayStyle = "absolute"
	PathStyleMarkdown      PathDisplayStyle = "markdown"
	PathStyleWiki          PathDisplayStyle = "wiki"
)

type RenderPreviewRequest

type RenderPreviewRequest struct {
	Root       string
	SourcePath string
	Body       string
	Mode       string
	MaxDepth   int
	MaxBytes   int
}

type RenderPreviewResult

type RenderPreviewResult struct {
	Body           string
	EmbeddedAssets []EmbeddedAssetPreview
}

func RenderEmbeddedPreview

func RenderEmbeddedPreview(req RenderPreviewRequest) (RenderPreviewResult, error)

type Verification

type Verification = domain.AssetVerification

type VerifyResult

type VerifyResult = domain.AssetVerifyResult

func Verify

func Verify(root string) (VerifyResult, error)

Jump to

Keyboard shortcuts

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