astro-lilypond 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ky Decker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # astro-lilypond
2
+
3
+ An [Astro](https://astro.build) integration for rendering [LilyPond](https://lilypond.org) music notation to images.
4
+
5
+ ## Quick Start
6
+
7
+ ### Prerequisites
8
+
9
+ Install the LilyPond binary directly from [lilypond.org](https://lilypond.org/download.html) or with a package manager like [Homebrew](https://formulae.brew.sh/formula/lilypond).
10
+
11
+ ```sh
12
+ brew install lilypond
13
+ ```
14
+
15
+ ### Installation
16
+
17
+ #### 1. Install `astro-lilypond`:
18
+
19
+ ```sh
20
+ pnpm add astro-lilypond
21
+ ```
22
+
23
+ #### 2. Add the integration to your Astro config:
24
+
25
+ ```js
26
+ // astro.config.mjs
27
+ import { defineConfig } from 'astro/config';
28
+ import lilypond from 'astro-lilypond';
29
+
30
+ export default defineConfig({
31
+ integrations: [lilypond()]
32
+ });
33
+ ```
34
+
35
+ #### 3. Use in Markdown:
36
+
37
+ ````md
38
+ ```lilypond
39
+ \\score ...
40
+ ```
41
+ ````
42
+
43
+ ## Docs
44
+
45
+ Learn more at the [`astro-lilypond` docs](https://lilypond.ky.fyi).
@@ -0,0 +1,22 @@
1
+ import type { AstroIntegration } from "astro";
2
+ import type { OutputFormat } from "./util.js";
3
+ export type { OutputFormat };
4
+ export interface LilypondOptions {
5
+ /**
6
+ * LilyPond version string to prepend automatically to every block that
7
+ * doesn't already declare `\version`. Example: `"2.24.0"`.
8
+ *
9
+ * When omitted, blocks must include `\version` themselves.
10
+ */
11
+ version?: string;
12
+ /**
13
+ * Output format. Defaults to `"svg"`.
14
+ *
15
+ * - `"svg"` — inline SVG embedded directly in the HTML (default)
16
+ * - `"png"` — `<img>` element with a base64 data URI, at the default resolution
17
+ * - `{ type: "png", resolution: number }` — PNG at a specific DPI
18
+ */
19
+ format?: OutputFormat;
20
+ }
21
+ export default function lilypond(options?: LilypondOptions): AstroIntegration;
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAM9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B,MAAM,WAAW,eAAe;IAC/B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,gBAAgB,CAoFhF"}
package/dist/index.js ADDED
@@ -0,0 +1,72 @@
1
+ import { execFile } from "child_process";
2
+ import { promisify } from "util";
3
+ import { remarkLilypondPlugin } from "./remark-plugin.js";
4
+ import { rehypeLilypondPlugin } from "./rehype-plugin.js";
5
+ import { satteriLilypondPlugin } from "./satteri-plugin.js";
6
+ const execFileAsync = promisify(execFile);
7
+ export default function lilypond(options = {}) {
8
+ return {
9
+ name: "astro-lilypond",
10
+ hooks: {
11
+ "astro:config:setup": async ({ config, updateConfig, logger }) => {
12
+ await execFileAsync("lilypond", ["--version"]).catch((err) => {
13
+ if (err.code === "ENOENT") {
14
+ logger?.warn("astro-lilypond: `lilypond` binary not found — LilyPond blocks will render as errors. Install LilyPond and ensure it is on PATH.");
15
+ }
16
+ });
17
+ const existingProcessor = config.markdown?.processor;
18
+ if (existingProcessor?.name === "satteri") {
19
+ const { satteri, isSatteriProcessor } = await import("@astrojs/markdown-satteri");
20
+ if (!isSatteriProcessor(existingProcessor)) {
21
+ throw new Error("astro-lilypond: the active markdown processor reports the name " +
22
+ '"satteri" but failed the isSatteriProcessor check.');
23
+ }
24
+ const existingOptions = existingProcessor.options ?? {};
25
+ updateConfig({
26
+ markdown: {
27
+ processor: satteri({
28
+ ...existingOptions,
29
+ mdastPlugins: [
30
+ ...(existingOptions.mdastPlugins ?? []),
31
+ satteriLilypondPlugin({ version: options.version, format: options.format }),
32
+ ],
33
+ }),
34
+ },
35
+ });
36
+ logger?.info("astro-lilypond: registered Sätteri mdast plugin");
37
+ return;
38
+ }
39
+ if (existingProcessor?.name === "unified") {
40
+ const { unified, isUnifiedProcessor } = await import("@astrojs/markdown-remark");
41
+ if (!isUnifiedProcessor(existingProcessor)) {
42
+ throw new Error("astro-lilypond: the active markdown processor reports the name " +
43
+ '"unified" but failed the isUnifiedProcessor check.');
44
+ }
45
+ const existingOptions = existingProcessor.options ?? {};
46
+ updateConfig({
47
+ markdown: {
48
+ processor: unified({
49
+ ...existingOptions,
50
+ remarkPlugins: [
51
+ ...(existingOptions.remarkPlugins ?? []),
52
+ [remarkLilypondPlugin, { version: options.version, format: options.format }],
53
+ ],
54
+ rehypePlugins: [
55
+ ...(existingOptions.rehypePlugins ?? []),
56
+ [rehypeLilypondPlugin, { version: options.version, format: options.format }],
57
+ ],
58
+ }),
59
+ },
60
+ });
61
+ logger?.info("astro-lilypond: registered unified remark/rehype plugins");
62
+ return;
63
+ }
64
+ throw new Error("astro-lilypond requires a processor-based Astro markdown config. " +
65
+ "Set `markdown.processor` to `satteri(…)` (Astro 7 default) or " +
66
+ "`unified(…)` from `@astrojs/markdown-remark`, then add this integration. " +
67
+ `Detected processor: ${existingProcessor?.name ?? "none"}.`);
68
+ },
69
+ },
70
+ };
71
+ }
72
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAsB1C,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,OAAO,GAAoB,EAAE;IAC7D,OAAO;QACN,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE;YACN,oBAAoB,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE;gBAChE,MAAM,aAAa,CAAC,UAAU,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAA0B,EAAE,EAAE;oBACnF,IAAI,GAAG,CAAC,IAAI,KAA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AiB,CAAC,OAAO,IAAI,EAAE,CAAC;oBACxD,YAAY,CAAC;wBACZ,QAAQ,EAAE;4BACT,SAAS,EAAE,OAAO,CAAC;gCAClB,GAAG,eAAe;gCAClB,aAAa,EAAE;oCACd,GAAG,CAAC,eAAe,CAAC,aAAa,IAAI,EAAE,CAAC;oCACxC,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;iCAC5E;gCACD,aAAa,EAAE;oCACd,GAAG,CAAC,eAAe,CAAC,aAAa,IAAI,EAAE,CAAC;oCACxC,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;iCAC5E;6BACD,CAAC;yBACF;qBACD,CAAC,CAAC;oBACH,MAAM,EAAE,IAAI,CAAC,0DAA0D,CAAC,CAAC;oBACzE,OAAO;gBACR,CAAC;gBAED,MAAM,IAAI,KAAK,CACd,mEAAmE;oBAClE,gEAAgE;oBAChE,2EAA2E;oBAC3E,uBAAuB,iBAAiB,EAAE,IAAI,IAAI,MAAM,GAAG,CAC5D,CAAC;YACH,CAAC;SACD;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { OutputFormat } from "./util.js";
2
+ export interface RehypePluginOptions {
3
+ version?: string;
4
+ format?: OutputFormat;
5
+ }
6
+ export declare function rehypeLilypondPlugin(options?: RehypePluginOptions): (tree: any) => Promise<void>;
7
+ //# sourceMappingURL=rehype-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rehype-plugin.d.ts","sourceRoot":"","sources":["../src/rehype-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAQ9C,MAAM,WAAW,mBAAmB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;CACtB;AAKD,wBAAgB,oBAAoB,CACnC,OAAO,GAAE,mBAAwB,GAC/B,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAmD9B"}
@@ -0,0 +1,50 @@
1
+ import { visit } from "unist-util-visit";
2
+ import { render } from "./render.js";
3
+ import { errorHtml, isLilypondLang, prependVersion, renderToHtml, resolveFormat } from "./util.js";
4
+ // Typed loosely so it's assignable to both RehypePlugin and the unified
5
+ // Plugin generic regardless of which @types/hast version the host project pins.
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ export function rehypeLilypondPlugin(options = {}) {
8
+ return async (tree) => {
9
+ const promises = [];
10
+ visit(tree, "element", (node, index, parent) => {
11
+ if (node.tagName !== "pre" ||
12
+ node.children?.length !== 1 ||
13
+ node.children[0].type !== "element" ||
14
+ node.children[0].tagName !== "code" ||
15
+ index === undefined ||
16
+ !parent)
17
+ return;
18
+ const codeNode = node.children[0];
19
+ const cls = codeNode.properties?.className;
20
+ if (!Array.isArray(cls))
21
+ return;
22
+ const lang = cls.find((c) => c.startsWith("language-"))?.slice("language-".length);
23
+ if (!isLilypondLang(lang))
24
+ return;
25
+ const raw = codeNode.children
26
+ .filter((c) => c.type === "text")
27
+ .map((c) => c.value)
28
+ .join("");
29
+ const source = options.version
30
+ ? prependVersion(raw, options.version)
31
+ : raw;
32
+ const { format, resolution } = resolveFormat(options.format ?? "svg");
33
+ const promise = render(source, { format, resolution })
34
+ .then((buf) => {
35
+ const rawNode = {
36
+ type: "raw",
37
+ value: renderToHtml(buf, format),
38
+ };
39
+ parent.children[index] = rawNode;
40
+ })
41
+ .catch((err) => {
42
+ const rawNode = { type: "raw", value: errorHtml(err) };
43
+ parent.children[index] = rawNode;
44
+ });
45
+ promises.push(promise);
46
+ });
47
+ await Promise.all(promises);
48
+ };
49
+ }
50
+ //# sourceMappingURL=rehype-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rehype-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"mdast";
2
+ import type { Plugin } from "unified";
3
+ import type { OutputFormat } from "./util.js";
4
+ export interface RemarkPluginOptions {
5
+ version?: string;
6
+ format?: OutputFormat;
7
+ }
8
+ export declare const remarkLilypondPlugin: Plugin<[RemarkPluginOptions?], Root>;
9
+ //# sourceMappingURL=remark-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark-plugin.d.ts","sourceRoot":"","sources":["../src/remark-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,IAAI,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAItC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,WAAW,mBAAmB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAgCrE,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { visit } from "unist-util-visit";
2
+ import { render } from "./render.js";
3
+ import { errorHtml, isLilypondLang, prependVersion, renderToHtml, resolveFormat } from "./util.js";
4
+ export const remarkLilypondPlugin = (options = {}) => {
5
+ return async (tree) => {
6
+ const promises = [];
7
+ visit(tree, "code", (node, index, parent) => {
8
+ if (!isLilypondLang(node.lang) || index === undefined || !parent)
9
+ return;
10
+ const source = options.version
11
+ ? prependVersion(node.value, options.version)
12
+ : node.value;
13
+ const { format, resolution } = resolveFormat(options.format ?? "svg");
14
+ const promise = render(source, { format, resolution })
15
+ .then((buf) => {
16
+ const htmlNode = {
17
+ type: "html",
18
+ value: renderToHtml(buf, format),
19
+ };
20
+ parent.children[index] = htmlNode;
21
+ })
22
+ .catch((err) => {
23
+ const htmlNode = { type: "html", value: errorHtml(err) };
24
+ parent.children[index] = htmlNode;
25
+ });
26
+ promises.push(promise);
27
+ });
28
+ await Promise.all(promises);
29
+ };
30
+ };
31
+ //# sourceMappingURL=remark-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark-plugin.js","sourceRoot":"","sources":["../src/remark-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAQnG,MAAM,CAAC,MAAM,oBAAoB,GAAyC,CACzE,OAAO,GAAG,EAAE,EACX,EAAE;IACH,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,QAAQ,GAAoB,EAAE,CAAC;QAErC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM;gBAAE,OAAO;YAEzE,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO;gBAC7B,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC;gBAC7C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YACd,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC;YAEtE,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;iBACpD,IAAI,CAAC,CAAC,GAAG,EAAQ,EAAE;gBACnB,MAAM,QAAQ,GAAS;oBACtB,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC;iBAChC,CAAC;gBACF,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;YACnC,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,GAAG,EAAQ,EAAE;gBACpB,MAAM,QAAQ,GAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC/D,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;YACnC,CAAC,CAAC,CAAC;YAEJ,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ export type Format = "midi" | "pdf" | "ps" | "png" | "svg" | "eps";
2
+ export interface RenderOptions {
3
+ /** Output format. Defaults to `"svg"`. */
4
+ format?: Format;
5
+ /** Resolution in DPI (only applies to PNG). Defaults to `144`. */
6
+ resolution?: number;
7
+ /** Path to the `lilypond` binary. Defaults to `"lilypond"`. */
8
+ binaryPath?: string;
9
+ /**
10
+ * Crop the output SVG tightly to the content bounding box using
11
+ * `--define-default crop`. Defaults to `true`.
12
+ */
13
+ crop?: boolean;
14
+ }
15
+ export declare const defaultOptions: Required<RenderOptions>;
16
+ export declare function render(source: string, options?: RenderOptions): Promise<Buffer>;
17
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAWnE,MAAM,WAAW,aAAa;IAC7B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,aAAa,CAKlD,CAAC;AAEF,wBAAsB,MAAM,CAC3B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,aAAkB,GACzB,OAAO,CAAC,MAAM,CAAC,CAsCjB"}
package/dist/render.js ADDED
@@ -0,0 +1,71 @@
1
+ import { execFile } from "child_process";
2
+ import { mkdtemp, rm, writeFile } from "fs/promises";
3
+ import { join } from "path";
4
+ import { tmpdir } from "os";
5
+ import { promisify } from "util";
6
+ const execFileAsync = promisify(execFile);
7
+ const FORMAT_FLAGS = {
8
+ midi: null,
9
+ pdf: "--pdf",
10
+ png: "--png",
11
+ ps: "--ps",
12
+ svg: "--svg",
13
+ eps: "--eps",
14
+ };
15
+ export const defaultOptions = {
16
+ format: "svg",
17
+ resolution: 144,
18
+ binaryPath: "lilypond",
19
+ crop: true,
20
+ };
21
+ export async function render(source, options = {}) {
22
+ const opts = { ...defaultOptions, ...options };
23
+ if (!(opts.format in FORMAT_FLAGS)) {
24
+ throw new Error(`${opts.format} is not a supported format`);
25
+ }
26
+ const dir = await mkdtemp(join(tmpdir(), "astro-lilypond-"));
27
+ const inputPath = join(dir, "input.ly");
28
+ const outputBase = join(dir, "output");
29
+ try {
30
+ await writeFile(inputPath, source, "utf8");
31
+ const args = [
32
+ FORMAT_FLAGS[opts.format],
33
+ "--define-default",
34
+ `resolution=${opts.resolution ?? 144}`,
35
+ "--define-default",
36
+ "no-point-and-click",
37
+ ...(opts.crop ? ["--define-default", "crop"] : []),
38
+ "--silent",
39
+ "--output",
40
+ outputBase,
41
+ inputPath,
42
+ ].filter((a) => a !== null);
43
+ const { stderr } = await execFileAsync(opts.binaryPath ?? "lilypond", args);
44
+ if (stderr)
45
+ throw new Error(stderr);
46
+ return await readOutputFile(outputBase, opts.format, opts.crop);
47
+ }
48
+ finally {
49
+ await rm(dir, { recursive: true, force: true });
50
+ }
51
+ }
52
+ async function readOutputFile(base, format, crop) {
53
+ const { readFile } = await import("fs/promises");
54
+ // --define-default crop writes <base>.cropped.<format> alongside <base>.<format>
55
+ if (crop) {
56
+ try {
57
+ return await readFile(`${base}.cropped.${format}`);
58
+ }
59
+ catch {
60
+ // cropped output not present; fall through to standard path
61
+ }
62
+ }
63
+ // Regular output: single page → <base>.<format>, multi-page → <base>-1.<format>
64
+ try {
65
+ return await readFile(`${base}.${format}`);
66
+ }
67
+ catch {
68
+ return await readFile(`${base}-1.${format}`);
69
+ }
70
+ }
71
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAI1C,MAAM,YAAY,GAAkC;IACnD,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,EAAE,EAAE,MAAM;IACV,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;CACZ,CAAC;AAgBF,MAAM,CAAC,MAAM,cAAc,GAA4B;IACtD,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,GAAG;IACf,UAAU,EAAE,UAAU;IACtB,IAAI,EAAE,IAAI;CACV,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,MAAM,CAC3B,MAAc,EACd,OAAO,GAAkB,EAA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IACjE,CAAC;YAAS,CAAC;QACV,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;AACF,CAAC;AAED,KAAK,UAAU,cAAc,CAC5B,IAAY,EACZ,MAAc,EACd,IAAa;IAEb,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IAEjD,iFAAiF;IACjF,IAAI,IAAI,EAAE,CAAC;QACV,IAAI,CAAC;YACJ,OAAO,MAAM,QAAQ,CAAC,GAAG,IAAI,YAAY,MAAM,EAAE,CAAC,CAAC;QACpD,CAAC;QAAC,MAAM,CAAC;YACR,4DAA4D;QAC7D,CAAC;IACF,CAAC;IAED,gFAAgF;IAChF,IAAI,CAAC;QACJ,OAAO,MAAM,QAAQ,CAAC,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,MAAM,QAAQ,CAAC,GAAG,IAAI,MAAM,MAAM,EAAE,CAAC,CAAC;IAC9C,CAAC;AACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { MdastPluginDefinition } from "satteri";
2
+ import type { OutputFormat } from "./util.js";
3
+ export interface SatteriPluginOptions {
4
+ version?: string;
5
+ format?: OutputFormat;
6
+ }
7
+ export declare function satteriLilypondPlugin(options?: SatteriPluginOptions): MdastPluginDefinition;
8
+ //# sourceMappingURL=satteri-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"satteri-plugin.d.ts","sourceRoot":"","sources":["../src/satteri-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,qBAAqB,EAErB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,WAAW,oBAAoB;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,wBAAgB,qBAAqB,CACpC,OAAO,GAAE,oBAAyB,GAChC,qBAAqB,CAuBvB"}
@@ -0,0 +1,26 @@
1
+ import { render } from "./render.js";
2
+ import { errorHtml, isLilypondLang, prependVersion, renderToHtml, resolveFormat } from "./util.js";
3
+ export function satteriLilypondPlugin(options = {}) {
4
+ return {
5
+ name: "astro-lilypond",
6
+ // Returning an mdast Html node (type: 'html') emits the value verbatim.
7
+ // Sätteri's { rawHtml } escape hatch applies MDX brace-escaping which
8
+ // would corrupt SVG content, so we use the plain html node form instead.
9
+ async code(node, _ctx) {
10
+ if (!isLilypondLang(node.lang))
11
+ return undefined;
12
+ const source = options.version
13
+ ? prependVersion(node.value, options.version)
14
+ : node.value;
15
+ const { format, resolution } = resolveFormat(options.format ?? "svg");
16
+ try {
17
+ const buf = await render(source, { format, resolution });
18
+ return { type: "html", value: renderToHtml(buf, format) };
19
+ }
20
+ catch (err) {
21
+ return { type: "html", value: errorHtml(err) };
22
+ }
23
+ },
24
+ };
25
+ }
26
+ //# sourceMappingURL=satteri-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"satteri-plugin.js","sourceRoot":"","sources":["../src/satteri-plugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAQnG,MAAM,UAAU,qBAAqB,CACpC,OAAO,GAAyB,EAAE;IAElC,OAAO;QACN,IAAI,EAAE,gBAAgB;QACtB,wEAAwE;QACxE,sEAAsE;QACtE,yEAAyE;QACzE,KAAK,CAAC,IAAI,CACT,IAAoB,EACpB,IAAyB;YAEzB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,OAAO,SAAS,CAAC;YACjD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO;gBAC7B,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC;gBAC7C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YACd,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC;YACtE,IAAI,CAAC;gBACJ,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;gBACzD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC;YAC3D,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;YAChD,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC"}
package/dist/util.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ export type OutputFormat = "svg" | "png" | {
2
+ type: "png";
3
+ resolution: number;
4
+ };
5
+ /** Returns true for both accepted fenced-block language identifiers: `lilypond` and `ly`. */
6
+ export declare function isLilypondLang(lang: string | null | undefined): boolean;
7
+ /** Normalises an OutputFormat value into a plain format string and optional resolution (DPI). */
8
+ export declare function resolveFormat(format: OutputFormat): {
9
+ format: "svg" | "png";
10
+ resolution?: number;
11
+ };
12
+ export declare function escapeHtml(text: unknown): string;
13
+ /**
14
+ * If `version` is provided and the source doesn't already declare `\version`,
15
+ * prepend `\version "X.X.X"` so users don't need to write it manually.
16
+ */
17
+ export declare function prependVersion(source: string, version: string): string;
18
+ /** Converts a rendered LilyPond buffer to an HTML string suitable for inline embedding. */
19
+ export declare function renderToHtml(buf: Buffer, format: "svg" | "png"): string;
20
+ /** Returns a safe HTML string for an error block (no node wrapping). */
21
+ export declare function errorHtml(err: unknown): string;
22
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,6FAA6F;AAC7F,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEvE;AAED,iGAAiG;AACjG,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG;IACpD,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,CAGA;AAUD,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGtE;AAED,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAMvE;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAG9C"}
package/dist/util.js ADDED
@@ -0,0 +1,43 @@
1
+ /** Returns true for both accepted fenced-block language identifiers: `lilypond` and `ly`. */
2
+ export function isLilypondLang(lang) {
3
+ return lang === "lilypond" || lang === "ly";
4
+ }
5
+ /** Normalises an OutputFormat value into a plain format string and optional resolution (DPI). */
6
+ export function resolveFormat(format) {
7
+ if (typeof format === "string")
8
+ return { format };
9
+ return { format: format.type, resolution: format.resolution };
10
+ }
11
+ const HTML_ENTITIES = {
12
+ "&": "&amp;",
13
+ "<": "&lt;",
14
+ ">": "&gt;",
15
+ '"': "&quot;",
16
+ "'": "&#39;",
17
+ };
18
+ export function escapeHtml(text) {
19
+ return String(text).replace(/[&<>"']/g, (c) => HTML_ENTITIES[c] ?? c);
20
+ }
21
+ /**
22
+ * If `version` is provided and the source doesn't already declare `\version`,
23
+ * prepend `\version "X.X.X"` so users don't need to write it manually.
24
+ */
25
+ export function prependVersion(source, version) {
26
+ if (/\\version\b/.test(source))
27
+ return source;
28
+ return `\\version "${version}"\n${source}`;
29
+ }
30
+ /** Converts a rendered LilyPond buffer to an HTML string suitable for inline embedding. */
31
+ export function renderToHtml(buf, format) {
32
+ if (format === "png") {
33
+ const b64 = buf.toString("base64");
34
+ return `<img class="lilypond" src="data:image/png;base64,${b64}" alt="LilyPond notation">`;
35
+ }
36
+ return buf.toString("utf-8").replace(/<svg\b/, '<svg class="lilypond"');
37
+ }
38
+ /** Returns a safe HTML string for an error block (no node wrapping). */
39
+ export function errorHtml(err) {
40
+ const msg = escapeHtml(err instanceof Error ? err.message : String(err));
41
+ return `<div class="lilypond-error" style="color:red;padding:1rem;border:1px solid red;border-radius:0.5rem;font-family:monospace"><strong>LilyPond error:</strong> ${msg}</div>`;
42
+ }
43
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,MAAM,UAAU,cAAc,CAAC,IAA+B;IAC7D,OAAO,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,IAAI,CAAC;AAC7C,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,aAAa,CAAC,MAAoB;IAIjD,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;AAC/D,CAAC;AAED,MAAM,aAAa,GAA2B;IAC7C,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,OAAO;CACZ,CAAC;AAEF,MAAM,UAAU,UAAU,CAAC,IAAa;IACvC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACvE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,OAAe;IAC7D,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC9C,OAAO,cAAc,OAAO,MAAM,MAAM,EAAE,CAAC;AAC5C,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,MAAqB;IAC9D,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnC,OAAO,oDAAoD,GAAG,4BAA4B,CAAC;IAC5F,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;AACzE,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,SAAS,CAAC,GAAY;IACrC,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACzE,OAAO,+JAA+J,GAAG,QAAQ,CAAC;AACnL,CAAC"}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "astro-lilypond",
3
+ "version": "0.1.0",
4
+ "description": "An Astro integration for rendering Lilypond scores to images in Markdown.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "keywords": [
18
+ "astro",
19
+ "astro-integration",
20
+ "lilypond",
21
+ "music",
22
+ "markdown",
23
+ "score",
24
+ "engraving"
25
+ ],
26
+ "author": "Ky Decker",
27
+ "license": "MIT",
28
+ "devDependencies": {
29
+ "@astrojs/markdown-remark": "^7.2.1",
30
+ "@astrojs/markdown-satteri": "^0.3.4",
31
+ "@changesets/cli": "^2.31.0",
32
+ "@types/mdast": "^4.0.4",
33
+ "@types/node": "^26.1.1",
34
+ "astro": "^7.0.8",
35
+ "biome": "^0.3.3",
36
+ "nano-staged": "^1.0.2",
37
+ "satteri": "^0.9.5",
38
+ "simple-git-hooks": "^2.13.1",
39
+ "typescript": "^7.0.2",
40
+ "unified": "^11.0.5",
41
+ "vitest": "^4.1.10",
42
+ "wrangler": "^4.110.0"
43
+ },
44
+ "peerDependencies": {
45
+ "astro": ">=7.0.0"
46
+ },
47
+ "dependencies": {
48
+ "unist-util-visit": "^5.1.0"
49
+ },
50
+ "simple-git-hooks": {
51
+ "pre-commit": "./node_modules/.bin/nano-staged"
52
+ },
53
+ "nano-staged": {
54
+ "*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,json,jsonc,css,astro}": [
55
+ "biome check --write"
56
+ ]
57
+ },
58
+ "scripts": {
59
+ "build": "tsc --project tsconfig.json",
60
+ "release": "changeset publish",
61
+ "check": "biome check",
62
+ "check:fix": "biome check --write",
63
+ "test": "vitest"
64
+ }
65
+ }