Collections Reference
lilypondLoader(), imported from astro-lilypond/loader, accepts the following options.
Options
Section titled “Options”Type: string | URL
Required: yes
The directory pattern resolves from. Relative to the project root.
pattern
Section titled “pattern”Type: string | string[]
Default: "**/*.{ly,ily,lilypond}"
Glob pattern(s) matching score files, relative to base.
generateId
Section titled “generateId”Type: (options: { entry: string; base: URL; header: Record<string, string> }) => string
Default: the file’s path relative to base, with its extension stripped (e.g. preludes/prelude-1.ly becomes preludes/prelude-1).
Generates each entry’s collection id. header is the file’s parsed \header fields, so you can key ids off metadata instead of the file path if you’d like.
format
Section titled “format”Type: "svg" | "png"
Default: "svg"
The image format each score is rendered to.
defaults
Section titled “defaults”Type: object
Default: same as the integration’s defaults
Default settings applied to every score this loader renders.
timeout
Section titled “timeout”Type: number
Default: 60000
Milliseconds to wait for a single lilypond invocation before aborting.
LilypondCollectionEntry type
Section titled “LilypondCollectionEntry type”Each collection entry’s data has the following shape:
interface LilypondCollectionEntry { // Rendered images pages: { src: string; width?: number; height?: number }[];
// Autogenerated alt text alt?: string;
// Header metadata arranger?: string; composer?: string; copyright?: string; dedication?: string; instrument?: string; meter?: string; opus?: string; piece?: string; poet?: string; subsubtitle?: string; subtitle?: string; tagline?: string; title?: string;
// Everything else found in the file's \header block(s) extra: Record<string, string>;}Data can be passed directly to the <LilyPond> component to render images:
---import { getEntry } from "astro:content";import LilyPond from "astro-lilypond/component";
const entry = await getEntry("scores", "my-score");---
<h3>{entry.data.title}</h3><LilyPond content={entry.data} />