From cfa6508c57bf5615a5f9b35b8002ff6fb09b6768 Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Thu, 4 Jun 2026 10:42:52 -0700 Subject: [PATCH 01/14] Document the a11y workflow (#2896) --- docs/accessibility-and-performance.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/accessibility-and-performance.md b/docs/accessibility-and-performance.md index bd7a7956d..a19ef11f3 100644 --- a/docs/accessibility-and-performance.md +++ b/docs/accessibility-and-performance.md @@ -44,6 +44,17 @@ The MyST themes ship with these accessibility behaviors: In April 2026 we completed a focused round of work to [align with WCAG 2.1 AA](https://github.com/jupyter-book/mystmd/issues/2802). We know there is always ongoing work to be done to improve accessibility and welcome both guidance and contributions, see [](#a11y:contribute). +(a11y:monitor)= +### How we monitor accessibility + +On every push to `main`, `myst-theme` runs an automated accessibility audit in CI. +It builds the current themes and runs [`berkeley-cdss/myst-a11y`](https://github.com/berkeley-cdss/myst-a11y) (which wraps [axe-core](https://github.com/dequelabs/axe-core)) against the [reference pages](https://myst-theme.netlify.app), checking WCAG 2.0 and 2.1 (A & AA). + +Results are surfaced in a tracking issue with the [`a11y-audit` label](https://github.com/jupyter-book/myst-theme/labels/a11y-audit). +It summarizes the current issue counts broken down by rule (such as color-contrast, label, and image-alt) and by page. +If an issue with that label is already open, it will be updated on each new workflow run. +If there is no open issue, then a new one is created. + ### Cell outputs are not under MyST's control Many libraries emit interactive JavaScript or images as part of executing code (e.g., Plotly, ipywidgets, etc). @@ -57,12 +68,13 @@ The fix will most likely need to happen in that upstream tool rather than in the Open accessibility work is tracked under the [`a11y` label in `myst-theme`](https://github.com/jupyter-book/myst-theme/labels/a11y). There's a thread for broader discussion and tracking in the [Accessibility Improvements tracking issue](https://github.com/jupyter-book/myst-theme/issues/238). +(a11y:check-your-site)= ### How can I check the accessibility of my own site? A few tools that others in the community have found useful: - The [Jupyter Accessibility Working Group](https://jupyter-accessibility.readthedocs.io) has a collection of accessibility resources for the broader Jupyter community. -- [berkeley-cdss/myst-a11y](https://github.com/berkeley-cdss/myst-a11y) is a GitHub Action built for MyST sites. It runs [axe-core](https://github.com/dequelabs/axe-core) checks against WCAG 2.0 and 2.1 (A and AA) on every push and reports results as a tracking issue. See [data-8/textbook](https://github.com/data-8/textbook/blob/main/.github/workflows/a11y.yml) for a working example. +- [berkeley-cdss/myst-a11y](https://github.com/berkeley-cdss/myst-a11y) is a GitHub Action built for MyST sites. It runs [axe-core](https://github.com/dequelabs/axe-core) checks against WCAG 2.0 and 2.1 (A and AA) on every push and reports results as a tracking issue. This is the same action MyST runs on its own themes, see [](#a11y:monitor). For a working example, see [data-8/textbook](https://github.com/data-8/textbook/blob/main/.github/workflows/a11y.yml). - [Lighthouse](https://github.com/GoogleChrome/lighthouse) is built into Chrome DevTools and is useful for a quick audit of a single page. - [JupyCheck](https://jupycheck.vercel.app/) checks accessibility of source notebooks in Jupyter interfaces. This is useful if you also want readers to launch Jupyter sessions from your MyST site. From f3d6c0153a40f5d2ebeb4d5bbc04bbf1e10cc603 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 4 Jun 2026 19:28:39 +0100 Subject: [PATCH 02/14] =?UTF-8?q?=F0=9F=9A=80=20v1.10.0=20(#2871)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/chubby-nails-look.md | 7 -- .changeset/citation-html-stop.md | 5 -- .changeset/fine-meals-fall.md | 6 -- .changeset/index-redirect-head-end.md | 6 -- .changeset/legal-flowers-drum.md | 5 -- .changeset/lemon-houses-retire.md | 8 -- .changeset/public-worms-kiss.md | 7 -- .changeset/salty-oranges-teach.md | 5 -- bun.lock | 119 ++++++------------------- packages/markdown-it-myst/CHANGELOG.md | 6 ++ packages/markdown-it-myst/package.json | 2 +- packages/myst-cli/CHANGELOG.md | 28 ++++++ packages/myst-cli/package.json | 20 ++--- packages/myst-common/CHANGELOG.md | 7 ++ packages/myst-common/package.json | 6 +- packages/myst-config/CHANGELOG.md | 12 +++ packages/myst-config/package.json | 6 +- packages/myst-directives/CHANGELOG.md | 7 ++ packages/myst-directives/package.json | 6 +- packages/myst-execute/CHANGELOG.md | 12 +++ packages/myst-execute/package.json | 4 +- packages/myst-frontmatter/CHANGELOG.md | 6 ++ packages/myst-frontmatter/package.json | 2 +- packages/myst-migrate/CHANGELOG.md | 6 ++ packages/myst-migrate/package.json | 2 +- packages/myst-parser/CHANGELOG.md | 10 +++ packages/myst-parser/package.json | 14 +-- packages/myst-roles/CHANGELOG.md | 7 ++ packages/myst-roles/package.json | 6 +- packages/myst-spec-ext/CHANGELOG.md | 2 + packages/myst-spec-ext/package.json | 2 +- packages/myst-to-html/CHANGELOG.md | 6 ++ packages/myst-to-html/package.json | 4 +- packages/myst-to-typst/CHANGELOG.md | 11 +++ packages/myst-to-typst/package.json | 8 +- packages/myst-transforms/CHANGELOG.md | 10 +++ packages/myst-transforms/package.json | 10 +-- packages/mystmd/CHANGELOG.md | 8 ++ packages/mystmd/package.json | 4 +- 39 files changed, 214 insertions(+), 188 deletions(-) delete mode 100644 .changeset/chubby-nails-look.md delete mode 100644 .changeset/citation-html-stop.md delete mode 100644 .changeset/fine-meals-fall.md delete mode 100644 .changeset/index-redirect-head-end.md delete mode 100644 .changeset/legal-flowers-drum.md delete mode 100644 .changeset/lemon-houses-retire.md delete mode 100644 .changeset/public-worms-kiss.md delete mode 100644 .changeset/salty-oranges-teach.md diff --git a/.changeset/chubby-nails-look.md b/.changeset/chubby-nails-look.md deleted file mode 100644 index a142b5a6a..000000000 --- a/.changeset/chubby-nails-look.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'myst-to-typst': patch -'myst-cli': patch -'mystmd': patch ---- - -Fix \left| and \right| delimeters (rely on upstream fix in tex-to-typst) diff --git a/.changeset/citation-html-stop.md b/.changeset/citation-html-stop.md deleted file mode 100644 index ce2f6e4d1..000000000 --- a/.changeset/citation-html-stop.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"markdown-it-myst": patch ---- - -Stop citation label parsing at `<` so following HTML and autolinks are preserved diff --git a/.changeset/fine-meals-fall.md b/.changeset/fine-meals-fall.md deleted file mode 100644 index b888d39a9..000000000 --- a/.changeset/fine-meals-fall.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"myst-cli": patch -"myst-execute": patch ---- - -Only copy thebe JS when necessary diff --git a/.changeset/index-redirect-head-end.md b/.changeset/index-redirect-head-end.md deleted file mode 100644 index cdeec6c66..000000000 --- a/.changeset/index-redirect-head-end.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'myst-cli': patch -'mystmd': patch ---- - -Append the index-redirect script to the end of `` instead of the beginning, so other site `` content (e.g. preloads, meta tags) is not affected by the script's placement. diff --git a/.changeset/legal-flowers-drum.md b/.changeset/legal-flowers-drum.md deleted file mode 100644 index 58a526b14..000000000 --- a/.changeset/legal-flowers-drum.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'myst-to-typst': patch ---- - -Add passthrough `card` wrapping the card content such that custom styling can be applied by the `typst` template diff --git a/.changeset/lemon-houses-retire.md b/.changeset/lemon-houses-retire.md deleted file mode 100644 index b6adc72d7..000000000 --- a/.changeset/lemon-houses-retire.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'myst-execute': minor -'myst-frontmatter': minor -'myst-config': minor -'myst-cli': minor ---- - -Add static_files option to project frontmatter for copying files into build output with stable URLs diff --git a/.changeset/public-worms-kiss.md b/.changeset/public-worms-kiss.md deleted file mode 100644 index 5d06524b0..000000000 --- a/.changeset/public-worms-kiss.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'myst-migrate': patch -'myst-cli': patch -'mystmd': patch ---- - -Allow for myst.yaml as well as myst.yml. diff --git a/.changeset/salty-oranges-teach.md b/.changeset/salty-oranges-teach.md deleted file mode 100644 index 9ae2d3e02..000000000 --- a/.changeset/salty-oranges-teach.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"myst-execute": patch ---- - -Choose a random port on execution diff --git a/bun.lock b/bun.lock index b5aa90665..d0a5f1249 100644 --- a/bun.lock +++ b/bun.lock @@ -82,7 +82,7 @@ }, "packages/markdown-it-myst": { "name": "markdown-it-myst", - "version": "1.0.16", + "version": "1.0.17", "dependencies": { "js-yaml": "^4.1.0", "vfile": "^5.3.7", @@ -97,7 +97,7 @@ }, "packages/myst-cli": { "name": "myst-cli", - "version": "1.8.2", + "version": "1.10.0", "dependencies": { "@jupyterlab/services": "^7.3.0", "@reduxjs/toolkit": "^2.1.0", @@ -189,7 +189,7 @@ }, "packages/myst-cli-utils": { "name": "myst-cli-utils", - "version": "2.0.13", + "version": "2.0.14", "dependencies": { "chalk": "^5.2.0", "pretty-hrtime": "^1.0.3", @@ -202,10 +202,10 @@ }, "packages/myst-common": { "name": "myst-common", - "version": "1.9.5", + "version": "1.10.0", "dependencies": { "mdast": "^3.0.0", - "myst-frontmatter": "^1.9.5", + "myst-frontmatter": "^1.10.0", "myst-spec": "^0.0.5", "nanoid": "^5.1.6", "unified": "^10.1.2", @@ -218,13 +218,13 @@ "devDependencies": { "@jupyterlab/nbformat": "^3.5.2", "@lumino/coreutils": "^2.0.0", - "myst-spec-ext": "^1.9.5", + "myst-spec-ext": "^1.10.0", "unist-builder": "3.0.0", }, }, "packages/myst-config": { "name": "myst-config", - "version": "1.9.5", + "version": "1.10.0", "dependencies": { "myst-common": "^1.9.5", "myst-frontmatter": "^1.9.5", @@ -236,7 +236,7 @@ }, "packages/myst-directives": { "name": "myst-directives", - "version": "1.7.0", + "version": "1.7.3", "dependencies": { "classnames": "^2.3.2", "csv-parse": "^5.5.5", @@ -251,13 +251,14 @@ }, "packages/myst-execute": { "name": "myst-execute", - "version": "0.3.3", + "version": "0.4.0", "dependencies": { "@jupyterlab/nbformat": "^3.5.2", "@jupyterlab/services": "^7.3.0", "chalk": "^5.2.0", + "get-port": "^6.1.2", "myst-cli-utils": "^2.0.13", - "myst-common": "^1.9.3", + "myst-common": "^1.10.0", "node-fetch": "^3.3.0", "unist-util-select": "^4.0.3", "vfile": "^5.3.7", @@ -300,7 +301,7 @@ }, "packages/myst-ext-grid": { "name": "myst-ext-grid", - "version": "1.0.9", + "version": "1.1.0", "dependencies": { "myst-common": "^1.7.2", }, @@ -351,7 +352,7 @@ }, "packages/myst-frontmatter": { "name": "myst-frontmatter", - "version": "1.9.5", + "version": "1.10.0", "dependencies": { "credit-roles": "^2.1.0", "doi-utils": "^2.0.5", @@ -370,7 +371,7 @@ }, "packages/myst-migrate": { "name": "myst-migrate", - "version": "1.8.2", + "version": "1.10.0", "dependencies": { "unist-util-select": "^4.0.3", "unist-util-visit": "^4.1.2", @@ -383,7 +384,7 @@ }, "packages/myst-parser": { "name": "myst-parser", - "version": "1.7.0", + "version": "1.7.3", "dependencies": { "@types/markdown-it": "^13.0.0", "he": "^1.2.0", @@ -421,7 +422,7 @@ }, "packages/myst-roles": { "name": "myst-roles", - "version": "1.7.0", + "version": "1.7.3", "dependencies": { "myst-common": "^1.9.5", "myst-spec-ext": "^1.9.5", @@ -439,7 +440,7 @@ }, "packages/myst-spec-ext": { "name": "myst-spec-ext", - "version": "1.9.5", + "version": "1.10.0", "dependencies": { "myst-spec": "^0.0.5", }, @@ -480,7 +481,7 @@ }, "packages/myst-to-html": { "name": "myst-to-html", - "version": "1.7.0", + "version": "1.7.3", "dependencies": { "@types/markdown-it": "^13.0.1", "classnames": "^2.3.2", @@ -555,7 +556,7 @@ }, "packages/myst-to-tex": { "name": "myst-to-tex", - "version": "1.0.45", + "version": "1.0.46", "dependencies": { "myst-common": "^1.9.4", "myst-ext-proof": "^1.0.11", @@ -571,12 +572,12 @@ }, "packages/myst-to-typst": { "name": "myst-to-typst", - "version": "0.0.36", + "version": "0.0.38", "dependencies": { - "myst-common": "^1.9.4", - "myst-frontmatter": "^1.9.4", - "myst-spec-ext": "^1.9.4", - "tex-to-typst": "^0.0.18", + "myst-common": "^1.10.0", + "myst-frontmatter": "^1.10.0", + "myst-spec-ext": "^1.10.0", + "tex-to-typst": "^0.0.20", "unist-util-select": "^4.0.3", "vfile-reporter": "^7.0.4", }, @@ -590,7 +591,7 @@ }, "packages/myst-transforms": { "name": "myst-transforms", - "version": "1.3.47", + "version": "1.3.50", "dependencies": { "doi-utils": "^2.0.5", "hast-util-from-html": "^2.0.1", @@ -623,7 +624,7 @@ }, "packages/mystmd": { "name": "mystmd", - "version": "1.8.2", + "version": "1.10.0", "bin": { "myst": "./dist/myst.cjs", }, @@ -645,7 +646,7 @@ }, "packages/tex-to-myst": { "name": "tex-to-myst", - "version": "1.0.45", + "version": "1.0.46", "dependencies": { "@unified-latex/unified-latex": "^1.2.2", "myst-common": "^1.9.4", @@ -2425,7 +2426,7 @@ "tex-to-myst": ["tex-to-myst@workspace:packages/tex-to-myst"], - "tex-to-typst": ["tex-to-typst@0.0.18", "", { "dependencies": { "@unified-latex/unified-latex": "^1.4.0", "@unified-latex/unified-latex-util-arguments": "^1.4.0", "@unified-latex/unified-latex-util-parse": "^1.4.0" } }, "sha512-hFwpIW31t3YnkZJA+lemvt5rLSgFxRwMwOdod629HfYD/fM67ZNw/NPuV5a4AQhV1VPsr7UW8kZwPc7G7/ahkw=="], + "tex-to-typst": ["tex-to-typst@0.0.20", "", { "dependencies": { "@unified-latex/unified-latex": "^1.4.0", "@unified-latex/unified-latex-util-arguments": "^1.4.0", "@unified-latex/unified-latex-util-parse": "^1.4.0", "unified": "^10.1.2" } }, "sha512-q6cVBkEYAX+N8wgA5pmyw4I1URm12X0JDpBEEozo626G8MjJuOfsDeMwuLzodHJPuvsk/LRRtANxpqK8JwpiXQ=="], "text-table": ["text-table@0.2.0", "", {}, "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw=="], @@ -2671,22 +2672,10 @@ "@jupyterlab/services/@jupyterlab/nbformat": ["@jupyterlab/nbformat@4.4.8", "", { "dependencies": { "@lumino/coreutils": "^2.2.1" } }, "sha512-zhpmu4jkIGgjLRzClifnVmM1NKfrC+A7Gcz8hnXJBinJwf6nMZaQnnXo+J6G93e0epw0E/YBrJ1kI/JJWLMeCg=="], - "@jupyterlab/services/@lumino/coreutils": ["@lumino/coreutils@2.2.1", "", { "dependencies": { "@lumino/algorithm": "^2.0.3" } }, "sha512-yij4TnxDIum7xfFUsVvZB0oLv4shs2mNbn3juwtEIsruvVBPmurNzKX0Y8z2QetbP2AZ6MSFtBzEKsihf0H0VA=="], - "@jupyterlab/settingregistry/@jupyterlab/nbformat": ["@jupyterlab/nbformat@4.4.8", "", { "dependencies": { "@lumino/coreutils": "^2.2.1" } }, "sha512-zhpmu4jkIGgjLRzClifnVmM1NKfrC+A7Gcz8hnXJBinJwf6nMZaQnnXo+J6G93e0epw0E/YBrJ1kI/JJWLMeCg=="], - "@jupyterlab/settingregistry/@lumino/coreutils": ["@lumino/coreutils@2.2.1", "", { "dependencies": { "@lumino/algorithm": "^2.0.3" } }, "sha512-yij4TnxDIum7xfFUsVvZB0oLv4shs2mNbn3juwtEIsruvVBPmurNzKX0Y8z2QetbP2AZ6MSFtBzEKsihf0H0VA=="], - "@jupyterlab/settingregistry/json5": ["json5@2.2.3", "", { "bin": "lib/cli.js" }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="], - "@jupyterlab/statedb/@lumino/coreutils": ["@lumino/coreutils@2.2.1", "", { "dependencies": { "@lumino/algorithm": "^2.0.3" } }, "sha512-yij4TnxDIum7xfFUsVvZB0oLv4shs2mNbn3juwtEIsruvVBPmurNzKX0Y8z2QetbP2AZ6MSFtBzEKsihf0H0VA=="], - - "@lumino/commands/@lumino/coreutils": ["@lumino/coreutils@2.2.1", "", { "dependencies": { "@lumino/algorithm": "^2.0.3" } }, "sha512-yij4TnxDIum7xfFUsVvZB0oLv4shs2mNbn3juwtEIsruvVBPmurNzKX0Y8z2QetbP2AZ6MSFtBzEKsihf0H0VA=="], - - "@lumino/polling/@lumino/coreutils": ["@lumino/coreutils@2.2.1", "", { "dependencies": { "@lumino/algorithm": "^2.0.3" } }, "sha512-yij4TnxDIum7xfFUsVvZB0oLv4shs2mNbn3juwtEIsruvVBPmurNzKX0Y8z2QetbP2AZ6MSFtBzEKsihf0H0VA=="], - - "@lumino/signaling/@lumino/coreutils": ["@lumino/coreutils@2.2.1", "", { "dependencies": { "@lumino/algorithm": "^2.0.3" } }, "sha512-yij4TnxDIum7xfFUsVvZB0oLv4shs2mNbn3juwtEIsruvVBPmurNzKX0Y8z2QetbP2AZ6MSFtBzEKsihf0H0VA=="], - "@manypkg/find-root/@types/node": ["@types/node@12.20.55", "", {}, "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ=="], "@manypkg/find-root/find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="], @@ -2711,8 +2700,6 @@ "@unified-latex/unified-latex-util-to-string/prettier": ["prettier@2.8.8", "", { "bin": "bin-prettier.js" }, "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q=="], - "ajv-formats/ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], - "ansi-align/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], "ansi-escapes/type-fest": ["type-fest@0.21.3", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="], @@ -2727,8 +2714,6 @@ "cacheable-request/get-stream": ["get-stream@6.0.1", "", {}, "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg=="], - "cffjs/ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], - "check-node-version/chalk": ["chalk@3.0.0", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg=="], "check-node-version/semver": ["semver@6.3.1", "", { "bin": "bin/semver.js" }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], @@ -2787,8 +2772,6 @@ "eslint/cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="], - "eslint/escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], - "eslint/glob-parent": ["glob-parent@6.0.2", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="], "eslint/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], @@ -2891,8 +2874,6 @@ "mdast-util-find-and-replace/escape-string-regexp": ["escape-string-regexp@5.0.0", "", {}, "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw=="], - "meca/jats-xml": ["jats-xml@1.0.8", "", { "dependencies": { "adm-zip": "^0.5.10", "doi-utils": "^2.0.0", "fair-principles": "^2.0.0", "jats-fetch": "^1.0.8", "jats-tags": "^1.0.8", "jats-utils": "^1.0.8", "js-yaml": "^4.1.0", "node-fetch": "^3.3.1", "unist-util-is": "^5.2.1", "unist-util-remove": "^3.1.0", "unist-util-select": "^4.0.0", "which": "^3.0.1", "xml-js": "^1.6.11" }, "peerDependencies": { "chalk": "^5.2.0", "commander": "^10.0.1" }, "bin": { "jats": "dist/jats.cjs" } }, "sha512-yI1rbW/toz4x04/pDp1gsNcySxC4kFhJcU91sqBZdliCg5PXvCOCnb/OhGGPAD/vehBWGiGbdjuLbQ4WDcBSNA=="], - "module-definition/ast-module-types": ["ast-module-types@3.0.0", "", {}, "sha512-CMxMCOCS+4D+DkOQfuZf+vLrSEmY/7xtORwdxs4wtcC1wVgvk2MqFFTwQCFhvWsI4KPU9lcWXPI8DgRiz+xetQ=="], "module-definition/node-source-walk": ["node-source-walk@4.3.0", "", { "dependencies": { "@babel/parser": "^7.0.0" } }, "sha512-8Q1hXew6ETzqKRAs3jjLioSxNfT1cx74ooiF8RlAONwVMcfq+UdzLC2eB5qcPldUxaE5w3ytLkrmV1TGddhZTA=="], @@ -2989,8 +2970,6 @@ "tsutils/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], - "vite/fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" } }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], - "vite/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], "vitest/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], @@ -3051,16 +3030,12 @@ "@typescript-eslint/utils/eslint-scope/estraverse": ["estraverse@4.3.0", "", {}, "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="], - "ajv-formats/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], - "ansi-align/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], "ansi-align/string-width/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], "body-parser/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="], - "cffjs/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], - "check-node-version/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "check-node-version/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], @@ -3073,8 +3048,6 @@ "cliui/wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - "color/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - "concurrently/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "concurrently/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], @@ -3085,8 +3058,6 @@ "default-browser/execa/human-signals": ["human-signals@4.3.1", "", {}, "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ=="], - "default-browser/execa/onetime": ["onetime@6.0.0", "", { "dependencies": { "mimic-fn": "^4.0.0" } }, "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ=="], - "default-browser/execa/signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="], "dependency-tree/precinct/commander": ["commander@9.5.0", "", {}, "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ=="], @@ -3271,8 +3242,6 @@ "check-node-version/chalk/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], - "check-node-version/chalk/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], - "cliui/wrap-ansi/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], "concurrently/chalk/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], @@ -3283,16 +3252,12 @@ "default-browser/execa/cross-spawn/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], - "default-browser/execa/onetime/mimic-fn": ["mimic-fn@4.0.0", "", {}, "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw=="], - "eslint-config-next/@typescript-eslint/parser/@typescript-eslint/scope-manager/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@5.62.0", "", { "dependencies": { "@typescript-eslint/types": "5.62.0", "eslint-visitor-keys": "^3.3.0" } }, "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw=="], "eslint-config-next/@typescript-eslint/parser/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@5.62.0", "", { "dependencies": { "@typescript-eslint/types": "5.62.0", "eslint-visitor-keys": "^3.3.0" } }, "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw=="], "eslint/chalk/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], - "eslint/chalk/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], - "eslint/cross-spawn/shebang-command/shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], "execa/cross-spawn/shebang-command/shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], @@ -3311,22 +3276,16 @@ "log-symbols/chalk/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], - "log-symbols/chalk/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], - "log-update/cli-cursor/restore-cursor/onetime": ["onetime@7.0.0", "", { "dependencies": { "mimic-function": "^5.0.0" } }, "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ=="], "log-update/wrap-ansi/string-width/emoji-regex": ["emoji-regex@10.4.0", "", {}, "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw=="], "madge/chalk/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], - "madge/chalk/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], - "npm-run-all/chalk/supports-color/has-flag": ["has-flag@3.0.0", "", {}, "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="], "ora/chalk/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], - "ora/chalk/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], - "precinct/detective-typescript/@typescript-eslint/typescript-estree/@typescript-eslint/types": ["@typescript-eslint/types@4.33.0", "", {}, "sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ=="], "precinct/detective-typescript/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@4.33.0", "", { "dependencies": { "@typescript-eslint/types": "4.33.0", "eslint-visitor-keys": "^2.0.0" } }, "sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg=="], @@ -3345,38 +3304,16 @@ "spawndamnit/cross-spawn/shebang-command/shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], - "wrap-ansi-cjs/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - "yargs/string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], "@manypkg/find-root/find-up/locate-path/p-locate/p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="], - "check-node-version/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - - "cliui/wrap-ansi/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - - "concurrently/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - "default-browser/execa/cross-spawn/shebang-command/shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], - "eslint/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - - "inquirer/wrap-ansi/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - "intersphinx/myst-cli-utils/chalk/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], - "intersphinx/myst-cli-utils/chalk/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], - - "log-symbols/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - - "madge/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - - "ora/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - "precinct/detective-typescript/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@2.1.0", "", {}, "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw=="], "run-applescript/execa/cross-spawn/shebang-command/shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], - - "intersphinx/myst-cli-utils/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], } } diff --git a/packages/markdown-it-myst/CHANGELOG.md b/packages/markdown-it-myst/CHANGELOG.md index 0fd5f0324..5d07ac977 100644 --- a/packages/markdown-it-myst/CHANGELOG.md +++ b/packages/markdown-it-myst/CHANGELOG.md @@ -1,5 +1,11 @@ # markdown-it-myst +## 1.0.17 + +### Patch Changes + +- 70b417c: Stop citation label parsing at `<` so following HTML and autolinks are preserved + ## 1.0.16 ### Patch Changes diff --git a/packages/markdown-it-myst/package.json b/packages/markdown-it-myst/package.json index 293874d28..48fbff158 100644 --- a/packages/markdown-it-myst/package.json +++ b/packages/markdown-it-myst/package.json @@ -1,6 +1,6 @@ { "name": "markdown-it-myst", - "version": "1.0.16", + "version": "1.0.17", "sideEffects": false, "license": "MIT", "description": "markdown-it tokenizer for MyST roles and directives", diff --git a/packages/myst-cli/CHANGELOG.md b/packages/myst-cli/CHANGELOG.md index cb4a4234c..03abdb57b 100644 --- a/packages/myst-cli/CHANGELOG.md +++ b/packages/myst-cli/CHANGELOG.md @@ -1,5 +1,33 @@ # myst-cli +## 1.10.0 + +### Minor Changes + +- c738873: Add static_files option to project frontmatter for copying files into build output with stable URLs + +### Patch Changes + +- 53efcc7: Fix \left| and \right| delimeters (rely on upstream fix in tex-to-typst) +- fa23fa7: Only copy thebe JS when necessary +- bb1dc1d: Append the index-redirect script to the end of `` instead of the beginning, so other site `` content (e.g. preloads, meta tags) is not affected by the script's placement. +- 901c83b: Allow for myst.yaml as well as myst.yml. +- Updated dependencies [53efcc7] +- Updated dependencies [fa23fa7] +- Updated dependencies [c4b53c3] +- Updated dependencies [c738873] +- Updated dependencies [901c83b] +- Updated dependencies [5fcb458] + - myst-to-typst@0.0.38 + - myst-execute@0.4.0 + - myst-frontmatter@1.10.0 + - myst-config@1.10.0 + - myst-migrate@1.10.0 + - myst-parser@1.7.3 + - myst-common@1.10.0 + - myst-spec-ext@1.10.0 + - myst-transforms@1.3.50 + ## 1.9.1 ### Patch Changes diff --git a/packages/myst-cli/package.json b/packages/myst-cli/package.json index 1cd9daa3e..9d64c61b1 100644 --- a/packages/myst-cli/package.json +++ b/packages/myst-cli/package.json @@ -1,6 +1,6 @@ { "name": "myst-cli", - "version": "1.9.1", + "version": "1.10.0", "description": "Command line tools for MyST", "author": "Franklin Koch ", "license": "MIT", @@ -70,10 +70,10 @@ "meca": "^1.0.8", "mime-types": "^2.1.35", "myst-cli-utils": "^2.0.14", - "myst-common": "^1.9.5", - "myst-config": "^1.9.5", - "myst-migrate": "^1.9.1", - "myst-execute": "^0.3.5", + "myst-common": "^1.10.0", + "myst-config": "^1.10.0", + "myst-migrate": "^1.10.0", + "myst-execute": "^0.4.0", "myst-ext-button": "^0.0.1", "myst-ext-card": "^1.0.9", "myst-ext-exercise": "^1.0.9", @@ -82,18 +82,18 @@ "myst-ext-proof": "^1.0.12", "myst-ext-reactive": "^1.0.9", "myst-ext-tabs": "^1.0.9", - "myst-frontmatter": "^1.9.5", - "myst-parser": "^1.7.2", + "myst-frontmatter": "^1.10.0", + "myst-parser": "^1.7.3", "myst-spec": "^0.0.5", - "myst-spec-ext": "^1.9.5", + "myst-spec-ext": "^1.10.0", "myst-templates": "^1.0.27", "myst-to-docx": "^1.0.16", "myst-to-jats": "^1.0.35", "myst-to-md": "^1.0.16", "myst-to-tex": "^1.0.46", - "myst-to-typst": "^0.0.37", + "myst-to-typst": "^0.0.38", "myst-toc": "^0.1.4", - "myst-transforms": "^1.3.49", + "myst-transforms": "^1.3.50", "nanoid": "^5.1.6", "nbtx": "^0.4.0", "node-fetch": "^3.3.1", diff --git a/packages/myst-common/CHANGELOG.md b/packages/myst-common/CHANGELOG.md index a03818921..ead4c6a64 100644 --- a/packages/myst-common/CHANGELOG.md +++ b/packages/myst-common/CHANGELOG.md @@ -1,5 +1,12 @@ # myst-common +## 1.10.0 + +### Patch Changes + +- Updated dependencies [c738873] + - myst-frontmatter@1.10.0 + ## 1.9.5 ### Patch Changes diff --git a/packages/myst-common/package.json b/packages/myst-common/package.json index 1d40dcc2a..23ef1e4d4 100644 --- a/packages/myst-common/package.json +++ b/packages/myst-common/package.json @@ -1,7 +1,7 @@ { "name": "myst-common", "sideEffects": false, - "version": "1.9.5", + "version": "1.10.0", "type": "module", "exports": "./dist/index.js", "types": "./dist/index.d.ts", @@ -25,7 +25,7 @@ }, "dependencies": { "mdast": "^3.0.0", - "myst-frontmatter": "^1.9.5", + "myst-frontmatter": "^1.10.0", "myst-spec": "^0.0.5", "nanoid": "^5.1.6", "unified": "^10.1.2", @@ -36,7 +36,7 @@ "vfile-message": "^3.0.0" }, "devDependencies": { - "myst-spec-ext": "^1.9.5", + "myst-spec-ext": "^1.10.0", "unist-builder": "3.0.0", "@jupyterlab/nbformat": "^3.5.2", "@lumino/coreutils": "^2.0.0" diff --git a/packages/myst-config/CHANGELOG.md b/packages/myst-config/CHANGELOG.md index 118847477..23e9846c1 100644 --- a/packages/myst-config/CHANGELOG.md +++ b/packages/myst-config/CHANGELOG.md @@ -1,5 +1,17 @@ # myst-config +## 1.10.0 + +### Minor Changes + +- c738873: Add static_files option to project frontmatter for copying files into build output with stable URLs + +### Patch Changes + +- Updated dependencies [c738873] + - myst-frontmatter@1.10.0 + - myst-common@1.10.0 + ## 1.9.5 ### Patch Changes diff --git a/packages/myst-config/package.json b/packages/myst-config/package.json index 801aafda7..b9568162d 100644 --- a/packages/myst-config/package.json +++ b/packages/myst-config/package.json @@ -1,6 +1,6 @@ { "name": "myst-config", - "version": "1.9.5", + "version": "1.10.0", "license": "MIT", "description": "Project and site config types and validation for the mystmd ecosystem", "author": "Franklin Koch ", @@ -31,8 +31,8 @@ "url": "https://github.com/jupyter-book/mystmd/issues" }, "dependencies": { - "myst-common": "^1.9.5", - "myst-frontmatter": "^1.9.5", + "myst-common": "^1.10.0", + "myst-frontmatter": "^1.10.0", "simple-validators": "^1.2.0" }, "devDependencies": { diff --git a/packages/myst-directives/CHANGELOG.md b/packages/myst-directives/CHANGELOG.md index 85054b1f4..0c3d485c6 100644 --- a/packages/myst-directives/CHANGELOG.md +++ b/packages/myst-directives/CHANGELOG.md @@ -1,5 +1,12 @@ # myst-directives +## 1.7.3 + +### Patch Changes + +- myst-common@1.10.0 +- myst-spec-ext@1.10.0 + ## 1.7.2 ## 1.7.1 diff --git a/packages/myst-directives/package.json b/packages/myst-directives/package.json index 1c9621e05..b69e1adf0 100644 --- a/packages/myst-directives/package.json +++ b/packages/myst-directives/package.json @@ -1,6 +1,6 @@ { "name": "myst-directives", - "version": "1.7.2", + "version": "1.7.3", "sideEffects": false, "license": "MIT", "description": "Default directive definitions for MyST", @@ -35,8 +35,8 @@ "classnames": "^2.3.2", "csv-parse": "^5.5.5", "js-yaml": "^4.1.0", - "myst-common": "^1.9.5", - "myst-spec-ext": "^1.9.5", + "myst-common": "^1.10.0", + "myst-spec-ext": "^1.10.0", "json5": "^1.0.2", "nanoid": "^5.1.6", "unist-util-select": "^4.0.3", diff --git a/packages/myst-execute/CHANGELOG.md b/packages/myst-execute/CHANGELOG.md index 00c79512a..494f707df 100644 --- a/packages/myst-execute/CHANGELOG.md +++ b/packages/myst-execute/CHANGELOG.md @@ -1,5 +1,17 @@ # myst-execute +## 0.4.0 + +### Minor Changes + +- c738873: Add static_files option to project frontmatter for copying files into build output with stable URLs + +### Patch Changes + +- fa23fa7: Only copy thebe JS when necessary +- 5fcb458: Choose a random port on execution + - myst-common@1.10.0 + ## 0.3.5 ### Patch Changes diff --git a/packages/myst-execute/package.json b/packages/myst-execute/package.json index e7f887191..4adb5b8d2 100644 --- a/packages/myst-execute/package.json +++ b/packages/myst-execute/package.json @@ -1,6 +1,6 @@ { "name": "myst-execute", - "version": "0.3.5", + "version": "0.4.0", "sideEffects": false, "license": "MIT", "description": "Execute MyST content with Jupyter", @@ -37,7 +37,7 @@ "chalk": "^5.2.0", "get-port": "^6.1.2", "myst-cli-utils": "^2.0.13", - "myst-common": "^1.9.3", + "myst-common": "^1.10.0", "node-fetch": "^3.3.0", "unist-util-select": "^4.0.3", "vfile": "^5.3.7", diff --git a/packages/myst-frontmatter/CHANGELOG.md b/packages/myst-frontmatter/CHANGELOG.md index 0e50c97ca..4422312d7 100644 --- a/packages/myst-frontmatter/CHANGELOG.md +++ b/packages/myst-frontmatter/CHANGELOG.md @@ -1,5 +1,11 @@ # myst-frontmatter +## 1.10.0 + +### Minor Changes + +- c738873: Add static_files option to project frontmatter for copying files into build output with stable URLs + ## 1.9.5 ### Patch Changes diff --git a/packages/myst-frontmatter/package.json b/packages/myst-frontmatter/package.json index f29f86364..c9d9d47c3 100644 --- a/packages/myst-frontmatter/package.json +++ b/packages/myst-frontmatter/package.json @@ -1,6 +1,6 @@ { "name": "myst-frontmatter", - "version": "1.9.5", + "version": "1.10.0", "sideEffects": false, "license": "MIT", "description": "Frontmatter types and validation for the mystmd ecosystem", diff --git a/packages/myst-migrate/CHANGELOG.md b/packages/myst-migrate/CHANGELOG.md index 1b21a3f8f..27c8d2039 100644 --- a/packages/myst-migrate/CHANGELOG.md +++ b/packages/myst-migrate/CHANGELOG.md @@ -1,5 +1,11 @@ # myst-migrate +## 1.10.0 + +### Patch Changes + +- 901c83b: Allow for myst.yaml as well as myst.yml. + ## 1.9.1 ## 1.9.0 diff --git a/packages/myst-migrate/package.json b/packages/myst-migrate/package.json index 6b4bf1348..d3e474b4b 100644 --- a/packages/myst-migrate/package.json +++ b/packages/myst-migrate/package.json @@ -1,7 +1,7 @@ { "name": "myst-migrate", "sideEffects": false, - "version": "1.9.1", + "version": "1.10.0", "type": "module", "exports": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/packages/myst-parser/CHANGELOG.md b/packages/myst-parser/CHANGELOG.md index 38ef79f37..a70ba67d5 100644 --- a/packages/myst-parser/CHANGELOG.md +++ b/packages/myst-parser/CHANGELOG.md @@ -1,5 +1,15 @@ # myst-parser +## 1.7.3 + +### Patch Changes + +- Updated dependencies [70b417c] + - markdown-it-myst@1.0.17 + - myst-common@1.10.0 + - myst-roles@1.7.3 + - myst-directives@1.7.3 + ## 1.7.2 ### Patch Changes diff --git a/packages/myst-parser/package.json b/packages/myst-parser/package.json index 517a2148f..22e3bdf3f 100644 --- a/packages/myst-parser/package.json +++ b/packages/myst-parser/package.json @@ -1,6 +1,6 @@ { "name": "myst-parser", - "version": "1.7.2", + "version": "1.7.3", "description": "Markdown parser for MyST markdown in JavaScript", "author": "Rowan Cockett ", "homepage": "https://github.com/jupyter-book/mystmd/tree/main/packages/myst-parser", @@ -49,12 +49,12 @@ "markdown-it-dollarmath": "^0.5.0", "markdown-it-footnote": "^4.0.0", "markdown-it-front-matter": "^0.2.3", - "markdown-it-myst": "1.0.16", + "markdown-it-myst": "1.0.17", "markdown-it-myst-extras": "0.3.0", "markdown-it-task-lists": "^2.1.1", - "myst-common": "^1.9.5", - "myst-directives": "^1.7.2", - "myst-roles": "^1.7.2", + "myst-common": "^1.10.0", + "myst-directives": "^1.7.3", + "myst-roles": "^1.7.3", "myst-spec": "^0.0.5", "unified": "^10.1.1", "unist-builder": "^3.0.0", @@ -70,8 +70,8 @@ "@types/js-yaml": "^4.0.5", "@types/mdast": "^3.0.10", "js-yaml": "^4.1.0", - "myst-to-html": "^1.7.2", - "myst-transforms": "^1.3.49", + "myst-to-html": "^1.7.3", + "myst-transforms": "^1.3.50", "rehype-stringify": "^9.0.3" } } diff --git a/packages/myst-roles/CHANGELOG.md b/packages/myst-roles/CHANGELOG.md index 17a0a9ac0..b5e5014a9 100644 --- a/packages/myst-roles/CHANGELOG.md +++ b/packages/myst-roles/CHANGELOG.md @@ -1,5 +1,12 @@ # myst-roles +## 1.7.3 + +### Patch Changes + +- myst-common@1.10.0 +- myst-spec-ext@1.10.0 + ## 1.7.2 ## 1.7.1 diff --git a/packages/myst-roles/package.json b/packages/myst-roles/package.json index bdefcb536..cf4acf457 100644 --- a/packages/myst-roles/package.json +++ b/packages/myst-roles/package.json @@ -1,6 +1,6 @@ { "name": "myst-roles", - "version": "1.7.2", + "version": "1.7.3", "sideEffects": false, "license": "MIT", "description": "Default role definitions for MyST", @@ -32,7 +32,7 @@ "url": "https://github.com/jupyter-book/mystmd/issues" }, "dependencies": { - "myst-common": "^1.9.5", - "myst-spec-ext": "^1.9.5" + "myst-common": "^1.10.0", + "myst-spec-ext": "^1.10.0" } } diff --git a/packages/myst-spec-ext/CHANGELOG.md b/packages/myst-spec-ext/CHANGELOG.md index 4cd4e3ecd..7bbf8d126 100644 --- a/packages/myst-spec-ext/CHANGELOG.md +++ b/packages/myst-spec-ext/CHANGELOG.md @@ -1,5 +1,7 @@ # myst-spec-ext +## 1.10.0 + ## 1.9.5 ### Patch Changes diff --git a/packages/myst-spec-ext/package.json b/packages/myst-spec-ext/package.json index e3c13e5c8..34c0a9a03 100644 --- a/packages/myst-spec-ext/package.json +++ b/packages/myst-spec-ext/package.json @@ -1,6 +1,6 @@ { "name": "myst-spec-ext", - "version": "1.9.5", + "version": "1.10.0", "description": "Extensions for myst-spec that are used in mystmd", "author": "Rowan Cockett ", "homepage": "https://github.com/jupyter-book/mystmd/tree/main/packages/myst-spec-ext", diff --git a/packages/myst-to-html/CHANGELOG.md b/packages/myst-to-html/CHANGELOG.md index 66461c855..f619e9bc5 100644 --- a/packages/myst-to-html/CHANGELOG.md +++ b/packages/myst-to-html/CHANGELOG.md @@ -1,5 +1,11 @@ # myst-to-html +## 1.7.3 + +### Patch Changes + +- myst-common@1.10.0 + ## 1.7.2 ## 1.7.1 diff --git a/packages/myst-to-html/package.json b/packages/myst-to-html/package.json index e4bf958cc..9408600fe 100644 --- a/packages/myst-to-html/package.json +++ b/packages/myst-to-html/package.json @@ -1,6 +1,6 @@ { "name": "myst-to-html", - "version": "1.7.2", + "version": "1.7.3", "description": "Export from MyST mdast to HTML", "author": "Franklin Koch ", "homepage": "https://github.com/jupyter-book/mystmd/tree/main/packages/myst-to-html", @@ -45,7 +45,7 @@ "mdast": "^3.0.0", "mdast-util-find-and-replace": "^2.1.0", "mdast-util-to-hast": "^12.3.0", - "myst-common": "^1.9.5", + "myst-common": "^1.10.0", "rehype-format": "^4.0.1", "rehype-parse": "^8.0.4", "rehype-remark": "^9.1.2", diff --git a/packages/myst-to-typst/CHANGELOG.md b/packages/myst-to-typst/CHANGELOG.md index cfd9275ef..1f11da332 100644 --- a/packages/myst-to-typst/CHANGELOG.md +++ b/packages/myst-to-typst/CHANGELOG.md @@ -1,5 +1,16 @@ # myst-to-typst +## 0.0.38 + +### Patch Changes + +- 53efcc7: Fix \left| and \right| delimeters (rely on upstream fix in tex-to-typst) +- c4b53c3: Add passthrough `card` wrapping the card content such that custom styling can be applied by the `typst` template +- Updated dependencies [c738873] + - myst-frontmatter@1.10.0 + - myst-common@1.10.0 + - myst-spec-ext@1.10.0 + ## 0.0.37 ### Patch Changes diff --git a/packages/myst-to-typst/package.json b/packages/myst-to-typst/package.json index 7aa677528..ed69e7c95 100644 --- a/packages/myst-to-typst/package.json +++ b/packages/myst-to-typst/package.json @@ -1,6 +1,6 @@ { "name": "myst-to-typst", - "version": "0.0.37", + "version": "0.0.38", "description": "Export from MyST mdast to Typst", "author": "Rowan Cockett ", "homepage": "https://github.com/jupyter-book/mystmd/tree/main/packages/myst-to-tex", @@ -37,9 +37,9 @@ "url": "https://github.com/jupyter-book/mystmd/issues" }, "dependencies": { - "myst-common": "^1.9.4", - "myst-frontmatter": "^1.9.4", - "myst-spec-ext": "^1.9.4", + "myst-common": "^1.10.0", + "myst-frontmatter": "^1.10.0", + "myst-spec-ext": "^1.10.0", "tex-to-typst": "^0.0.20", "unist-util-select": "^4.0.3", "vfile-reporter": "^7.0.4" diff --git a/packages/myst-transforms/CHANGELOG.md b/packages/myst-transforms/CHANGELOG.md index caaf1c664..d5fe1e90d 100644 --- a/packages/myst-transforms/CHANGELOG.md +++ b/packages/myst-transforms/CHANGELOG.md @@ -1,5 +1,15 @@ # myst-transforms +## 1.3.50 + +### Patch Changes + +- Updated dependencies [c738873] + - myst-frontmatter@1.10.0 + - myst-common@1.10.0 + - myst-spec-ext@1.10.0 + - myst-to-html@1.7.3 + ## 1.3.49 ### Patch Changes diff --git a/packages/myst-transforms/package.json b/packages/myst-transforms/package.json index 409d71cca..3e46abf70 100644 --- a/packages/myst-transforms/package.json +++ b/packages/myst-transforms/package.json @@ -1,6 +1,6 @@ { "name": "myst-transforms", - "version": "1.3.49", + "version": "1.3.50", "sideEffects": false, "type": "module", "exports": "./dist/index.js", @@ -30,11 +30,11 @@ "katex": "^0.15.2", "hast-util-to-mdast": "^8.3.1", "mdast-util-find-and-replace": "^2.1.0", - "myst-common": "^1.9.5", - "myst-frontmatter": "^1.9.5", + "myst-common": "^1.10.0", + "myst-frontmatter": "^1.10.0", "myst-spec": "^0.0.5", - "myst-spec-ext": "^1.9.5", - "myst-to-html": "1.7.2", + "myst-spec-ext": "^1.10.0", + "myst-to-html": "1.7.3", "rehype-parse": "^8.0.4", "rehype-remark": "^9.1.2", "unified": "^10.0.0", diff --git a/packages/mystmd/CHANGELOG.md b/packages/mystmd/CHANGELOG.md index eea14592a..e194b5451 100644 --- a/packages/mystmd/CHANGELOG.md +++ b/packages/mystmd/CHANGELOG.md @@ -1,5 +1,13 @@ # mystmd +## 1.10.0 + +### Patch Changes + +- 53efcc7: Fix \left| and \right| delimeters (rely on upstream fix in tex-to-typst) +- bb1dc1d: Append the index-redirect script to the end of `` instead of the beginning, so other site `` content (e.g. preloads, meta tags) is not affected by the script's placement. +- 901c83b: Allow for myst.yaml as well as myst.yml. + ## 1.9.1 ### Patch Changes diff --git a/packages/mystmd/package.json b/packages/mystmd/package.json index fecd89857..682edab83 100644 --- a/packages/mystmd/package.json +++ b/packages/mystmd/package.json @@ -1,6 +1,6 @@ { "name": "mystmd", - "version": "1.9.1", + "version": "1.10.0", "description": "Command line tools for MyST Markdown", "author": "Rowan Cockett ", "license": "MIT", @@ -47,6 +47,6 @@ "commander": "^10.0.1", "core-js": "^3.31.1", "js-yaml": "^4.1.0", - "myst-cli": "^1.9.1" + "myst-cli": "^1.10.0" } } From a64fee1d008608a4ad4ca19dc9dbbe37d17447bb Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Fri, 5 Jun 2026 09:52:06 -0700 Subject: [PATCH 03/14] Revert thebe (#2903) Co-authored-by: Rowan Cockett --- .changeset/thin-chefs-glow.md | 5 +++++ packages/myst-cli/src/build/html/index.ts | 27 +++++------------------ 2 files changed, 11 insertions(+), 21 deletions(-) create mode 100644 .changeset/thin-chefs-glow.md diff --git a/.changeset/thin-chefs-glow.md b/.changeset/thin-chefs-glow.md new file mode 100644 index 000000000..68e8b9dc1 --- /dev/null +++ b/.changeset/thin-chefs-glow.md @@ -0,0 +1,5 @@ +--- +"myst-cli": patch +--- + +Revert stopping of thebe-copy for static build assets diff --git a/packages/myst-cli/src/build/html/index.ts b/packages/myst-cli/src/build/html/index.ts index 370bc5656..648c452db 100644 --- a/packages/myst-cli/src/build/html/index.ts +++ b/packages/myst-cli/src/build/html/index.ts @@ -25,18 +25,6 @@ import type { LocalProjectPage } from '../../project/types.js'; const limitConnections = pLimit(5); -/** - * Return true if any project in the current site has thebe configured. - * `project: jupyter: ...` aliases to `project: thebe`. - */ -function siteUsesThebe(session: ISession): boolean { - const state = session.store.getState(); - const siteConfig = selectors.selectCurrentSiteConfig(state); - return (siteConfig?.projects ?? []).some( - (proj) => !!proj.path && !!selectors.selectLocalProjectConfig(state, proj.path)?.thebe, - ); -} - export async function currentSiteRoutes( session: ISession, host: string, @@ -212,16 +200,13 @@ export async function buildHtml(session: ISession, opts: StartOptions) { ); await appServer.stop(); - // Copy files for the template used. - - // Skip thebe JS chunks unless they are required. + // Copy the files for the template used. + // + // This always includes the thebe JS chunks, even when no project enables + // `thebe`/`jupyter`. The myst-theme uses thebe-core to render Jupyter cell + // outputs, so these chunks are required for outputs to render at all. const templateBuildDir = path.join(template.templatePath, 'public'); - const hasThebe = siteUsesThebe(session); - fs.copySync(templateBuildDir, htmlDir, { - filter: (src) => - hasThebe || - !path.basename(src).match(/^(\d+\.)?(thebe-(core|lite)(\.min)?\.js|thebe-core.*\.css)$/), - }); + fs.copySync(templateBuildDir, htmlDir); // Copy all of the static assets fs.copySync(session.publicPath(), path.join(htmlDir, 'build')); From 07de2ef3fbe36ea070688f924f8a0869513501c1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 13:03:32 -0400 Subject: [PATCH 04/14] =?UTF-8?q?=F0=9F=9A=80=20Release=20(#2904)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/thin-chefs-glow.md | 5 ----- packages/myst-cli/CHANGELOG.md | 7 +++++++ packages/myst-cli/package.json | 4 ++-- packages/myst-migrate/CHANGELOG.md | 2 ++ packages/myst-migrate/package.json | 2 +- packages/mystmd/CHANGELOG.md | 2 ++ packages/mystmd/package.json | 4 ++-- 7 files changed, 16 insertions(+), 10 deletions(-) delete mode 100644 .changeset/thin-chefs-glow.md diff --git a/.changeset/thin-chefs-glow.md b/.changeset/thin-chefs-glow.md deleted file mode 100644 index 68e8b9dc1..000000000 --- a/.changeset/thin-chefs-glow.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"myst-cli": patch ---- - -Revert stopping of thebe-copy for static build assets diff --git a/packages/myst-cli/CHANGELOG.md b/packages/myst-cli/CHANGELOG.md index 03abdb57b..cd7f88eaf 100644 --- a/packages/myst-cli/CHANGELOG.md +++ b/packages/myst-cli/CHANGELOG.md @@ -1,5 +1,12 @@ # myst-cli +## 1.10.1 + +### Patch Changes + +- a64fee1: Revert stopping of thebe-copy for static build assets + - myst-migrate@1.10.1 + ## 1.10.0 ### Minor Changes diff --git a/packages/myst-cli/package.json b/packages/myst-cli/package.json index 9d64c61b1..370529c00 100644 --- a/packages/myst-cli/package.json +++ b/packages/myst-cli/package.json @@ -1,6 +1,6 @@ { "name": "myst-cli", - "version": "1.10.0", + "version": "1.10.1", "description": "Command line tools for MyST", "author": "Franklin Koch ", "license": "MIT", @@ -72,7 +72,7 @@ "myst-cli-utils": "^2.0.14", "myst-common": "^1.10.0", "myst-config": "^1.10.0", - "myst-migrate": "^1.10.0", + "myst-migrate": "^1.10.1", "myst-execute": "^0.4.0", "myst-ext-button": "^0.0.1", "myst-ext-card": "^1.0.9", diff --git a/packages/myst-migrate/CHANGELOG.md b/packages/myst-migrate/CHANGELOG.md index 27c8d2039..a644f9ba9 100644 --- a/packages/myst-migrate/CHANGELOG.md +++ b/packages/myst-migrate/CHANGELOG.md @@ -1,5 +1,7 @@ # myst-migrate +## 1.10.1 + ## 1.10.0 ### Patch Changes diff --git a/packages/myst-migrate/package.json b/packages/myst-migrate/package.json index d3e474b4b..b3aa76ec1 100644 --- a/packages/myst-migrate/package.json +++ b/packages/myst-migrate/package.json @@ -1,7 +1,7 @@ { "name": "myst-migrate", "sideEffects": false, - "version": "1.10.0", + "version": "1.10.1", "type": "module", "exports": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/packages/mystmd/CHANGELOG.md b/packages/mystmd/CHANGELOG.md index e194b5451..2c42e0e4b 100644 --- a/packages/mystmd/CHANGELOG.md +++ b/packages/mystmd/CHANGELOG.md @@ -1,5 +1,7 @@ # mystmd +## 1.10.1 + ## 1.10.0 ### Patch Changes diff --git a/packages/mystmd/package.json b/packages/mystmd/package.json index 682edab83..ef4ef831f 100644 --- a/packages/mystmd/package.json +++ b/packages/mystmd/package.json @@ -1,6 +1,6 @@ { "name": "mystmd", - "version": "1.10.0", + "version": "1.10.1", "description": "Command line tools for MyST Markdown", "author": "Rowan Cockett ", "license": "MIT", @@ -47,6 +47,6 @@ "commander": "^10.0.1", "core-js": "^3.31.1", "js-yaml": "^4.1.0", - "myst-cli": "^1.10.0" + "myst-cli": "^1.10.1" } } From b7cc18f04baafefb6151eafc5531218de811f3a3 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 5 Jun 2026 13:33:10 -0400 Subject: [PATCH 05/14] Update GitHub Actions to Node 24-compatible versions (#2905) --- .github/actions/install/action.yml | 4 ++-- .github/workflows/ci.yml | 8 ++++---- .github/workflows/docs.yml | 2 +- .github/workflows/enforce-label.yml | 2 +- .github/workflows/publish-github-release.yml | 4 ++-- .github/workflows/python-ci.yml | 16 ++++++++-------- .github/workflows/release.yml | 10 +++++----- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index c5e92a14e..e31e8cd2a 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -20,7 +20,7 @@ runs: # Even though we use bun for test runners, the mystmd bundle uses node, # so we need to install node and test against multiple versions. - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: ${{ inputs.node }} - name: Setup Bun @@ -28,7 +28,7 @@ runs: with: bun-version: ${{ inputs.bun-version }} - name: Install python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: '3.10' cache: 'pip' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c48c28dc..e5c307130 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 2 submodules: recursive @@ -36,7 +36,7 @@ jobs: name: Testing with bun and node ${{ matrix.node }} steps: - name: Checkout Repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 2 submodules: recursive @@ -52,11 +52,11 @@ jobs: name: Running test docs build steps: - name: Checkout Repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 2 submodules: recursive - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: "3.x" - name: Install myst diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e4954478b..69005d183 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,7 +16,7 @@ jobs: if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} steps: - name: Checkout Repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 2 submodules: recursive diff --git a/.github/workflows/enforce-label.yml b/.github/workflows/enforce-label.yml index 500be8f63..aa36fda57 100644 --- a/.github/workflows/enforce-label.yml +++ b/.github/workflows/enforce-label.yml @@ -11,7 +11,7 @@ jobs: steps: # As this is a pull_request_target, we'll get `main` here - name: Checkout contents - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Add labels uses: actions/labeler@v6 diff --git a/.github/workflows/publish-github-release.yml b/.github/workflows/publish-github-release.yml index ef53d49eb..7e6f419b7 100644 --- a/.github/workflows/publish-github-release.yml +++ b/.github/workflows/publish-github-release.yml @@ -20,7 +20,7 @@ jobs: contents: write steps: - name: Checkout Repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 # Get the date of the latest GitHub release - name: Get previous release tag @@ -36,7 +36,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: '3.x' diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 1e89a43d7..98fa81040 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 2 submodules: recursive @@ -31,7 +31,7 @@ jobs: - name: Build Python package run: pipx run hatch -- build working-directory: packages/mystmd-py - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: package path: packages/mystmd-py/dist/mystmd*.whl @@ -43,11 +43,11 @@ jobs: needs: [build-package] steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: fetch-depth: 2 submodules: recursive - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v8 with: name: package - name: Install myst from package @@ -63,11 +63,11 @@ jobs: needs: [build-package] steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: fetch-depth: 2 submodules: recursive - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v8 with: name: package - name: Run myst and expect failure @@ -82,11 +82,11 @@ jobs: needs: [build-package] steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: fetch-depth: 2 submodules: recursive - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v8 with: name: package - name: Run myst with nodeenv and expect success diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aa36100f0..18e1e9563 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: published: ${{ steps.changesets.outputs.published }} steps: - name: Checkout Repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 2 submodules: recursive @@ -52,12 +52,12 @@ jobs: python -m build working-directory: packages/mystmd-py - name: Store the Python packages - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: python-package-distributions path: packages/mystmd-py/dist/ - name: Store the JS packages - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: js-package-distributions path: packages/mystmd/dist/ @@ -75,7 +75,7 @@ jobs: id-token: write steps: - name: Download all the dists - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: python-package-distributions path: dist/ @@ -89,7 +89,7 @@ jobs: tag_name: ${{ steps.get_tag.outputs.tag_name }} steps: - name: Checkout Repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Get tag name from package.json id: get_tag run: | From 325253599d97596cd7c7a7d2c05d4f1309e9dfa7 Mon Sep 17 00:00:00 2001 From: Steve Purves Date: Mon, 8 Jun 2026 19:23:21 +0100 Subject: [PATCH 06/14] Allow figures to use grid directives for layout (#2899) Co-authored-by: Cursor Co-authored-by: Chris Holdgraf --- .changeset/proud-mangos-begin.md | 6 ++ docs/figures.md | 35 ++++++++-- .../myst-transforms/src/containers.spec.ts | 18 +++++ packages/myst-transforms/src/containers.ts | 5 +- .../mystmd/tests/grid-in-figure/.gitignore | 1 + packages/mystmd/tests/grid-in-figure/index.md | 65 +++++++++++++++++++ packages/mystmd/tests/grid-in-figure/myst.yml | 7 ++ 7 files changed, 131 insertions(+), 6 deletions(-) create mode 100644 .changeset/proud-mangos-begin.md create mode 100644 packages/mystmd/tests/grid-in-figure/.gitignore create mode 100644 packages/mystmd/tests/grid-in-figure/index.md create mode 100644 packages/mystmd/tests/grid-in-figure/myst.yml diff --git a/.changeset/proud-mangos-begin.md b/.changeset/proud-mangos-begin.md new file mode 100644 index 000000000..488c94e84 --- /dev/null +++ b/.changeset/proud-mangos-begin.md @@ -0,0 +1,6 @@ +--- +'myst-transforms': patch +'mystmd': patch +--- + +Allow `grid` directives to be used in `figure` directives diff --git a/docs/figures.md b/docs/figures.md index ae668333b..8b48e3799 100644 --- a/docs/figures.md +++ b/docs/figures.md @@ -33,6 +33,10 @@ For example, {myst:directive}`image.width`, {myst:directive}`alignment { if (child.type === 'container') child.subcontainer = true; @@ -45,6 +56,13 @@ describe('Test containerChildrenTransform', () => { expect(mdast).toEqual(rootContainer([anywidget(), caption()])); expect(file.messages.filter((m) => m.fatal)).toHaveLength(0); }); + test('figure with grid and caption is unchanged', async () => { + const mdast = rootContainer([grid(), caption()]); + const file = new VFile(); + containerChildrenTransform(mdast, file); + expect(mdast).toEqual(rootContainer([grid(), caption()])); + expect(file.messages.filter((m) => m.fatal)).toHaveLength(0); + }); test('figure with caption and one image is reordered', async () => { const mdast = rootContainer([caption(), image()]); containerChildrenTransform(mdast, new VFile()); diff --git a/packages/myst-transforms/src/containers.ts b/packages/myst-transforms/src/containers.ts index a432a8f19..20ea3254d 100644 --- a/packages/myst-transforms/src/containers.ts +++ b/packages/myst-transforms/src/containers.ts @@ -25,6 +25,7 @@ const SUBFIGURE_TYPES = [ 'output', 'card', 'anywidget', + 'grid', ]; /** Raise a warning if caption includes content that is expected to be directly on the figure */ @@ -115,7 +116,7 @@ function hoistContentOutOfParagraphs(tree: GenericParent) { * Update container children and add sub-figures * * - Valid container nodes are ensured to be first children. - * These include image/iframe/table/code/embed/block/container/anywidget nodes. + * These include image/iframe/table/code/embed/block/container/anywidget/grid nodes. * - If multiple of these are present, they are nested as sub-figures. * (This does not include placeholder images, which are left unchanged) * - A warning is raised if these node types are found in caption or legend @@ -199,7 +200,7 @@ export function containerChildrenTransform(tree: GenericParent, vfile: VFile) { { node: container, ruleId: RuleId.containerChildrenValid, - note: 'Valid content types include image, referenced notebook cell, table, code, cards, iframe, subfigure, anywidget', + note: 'Valid content types include image, referenced notebook cell, table, code, cards, iframe, subfigure, anywidget, grid', }, ); } diff --git a/packages/mystmd/tests/grid-in-figure/.gitignore b/packages/mystmd/tests/grid-in-figure/.gitignore new file mode 100644 index 000000000..69fa449dd --- /dev/null +++ b/packages/mystmd/tests/grid-in-figure/.gitignore @@ -0,0 +1 @@ +_build/ diff --git a/packages/mystmd/tests/grid-in-figure/index.md b/packages/mystmd/tests/grid-in-figure/index.md new file mode 100644 index 000000000..658f89e55 --- /dev/null +++ b/packages/mystmd/tests/grid-in-figure/index.md @@ -0,0 +1,65 @@ +# Grid inside figure + +Manual test for `grid` as valid figure content (see `myst-transforms` `SUBFIGURE_TYPES`). + +## Figure with grid and images + +::::::{figure} +:label: fig-grid-images + +:::::{grid} 1 2 2 2 + +::::{grid-item} + +![](https://picsum.photos/seed/grid-a/320/200) + +:::: + +::::{grid-item} + +![](https://picsum.photos/seed/grid-b/320/200) + +:::: + +::::{grid-item} + +![](https://picsum.photos/seed/grid-c/320/200) + +:::: + +::::: + +A figure caption with a responsive grid of images. + +:::::: + +## Figure with grid and text only + +::::::{figure} +:label: fig-grid-text + +:::::{grid} 1 1 2 2 + +::::{grid-item} + +Panel A + +:::: + +::::{grid-item} + +Panel B + +:::: + +::::{grid-item} + +Panel C + +:::: + +::::: + +Simple grid panels without widgets. + +:::::: diff --git a/packages/mystmd/tests/grid-in-figure/myst.yml b/packages/mystmd/tests/grid-in-figure/myst.yml new file mode 100644 index 000000000..f5ab2c9df --- /dev/null +++ b/packages/mystmd/tests/grid-in-figure/myst.yml @@ -0,0 +1,7 @@ +version: 1 +project: + title: Grid in figure test + toc: + - file: index.md +site: + template: ../templates/site/myst/book-theme From 12f4721de22d756348a9d1e52bd5a537c6613302 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Wed, 10 Jun 2026 09:02:02 +0100 Subject: [PATCH 07/14] fix: add missing dependencies that are required for proper exports (#2913) --- .changeset/tangy-mirrors-double.md | 6 ++++++ packages/markdown-it-myst/package.json | 3 ++- packages/markdown-it-myst/src/utils.ts | 3 ++- packages/myst-execute/src/transform.ts | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .changeset/tangy-mirrors-double.md diff --git a/.changeset/tangy-mirrors-double.md b/.changeset/tangy-mirrors-double.md new file mode 100644 index 000000000..3122ca2fa --- /dev/null +++ b/.changeset/tangy-mirrors-double.md @@ -0,0 +1,6 @@ +--- +'markdown-it-myst': patch +'myst-execute': patch +--- + +Fix dependencies / types diff --git a/packages/markdown-it-myst/package.json b/packages/markdown-it-myst/package.json index 48fbff158..b57d861af 100644 --- a/packages/markdown-it-myst/package.json +++ b/packages/markdown-it-myst/package.json @@ -33,7 +33,8 @@ }, "dependencies": { "js-yaml": "^4.1.0", - "vfile": "^5.3.7" + "vfile": "^5.3.7", + "vfile-message": "^3.0.0" }, "devDependencies": { "markdown-it-footnote": "^4.0.0" diff --git a/packages/markdown-it-myst/src/utils.ts b/packages/markdown-it-myst/src/utils.ts index 3fd32d9b9..a06a2f143 100644 --- a/packages/markdown-it-myst/src/utils.ts +++ b/packages/markdown-it-myst/src/utils.ts @@ -1,7 +1,8 @@ import type StateCore from 'markdown-it/lib/rules_core/state_core.js'; import type { VFile } from 'vfile'; +import type { VFileMessage } from 'vfile-message'; -export function stateWarn(state: StateCore, message: string) { +export function stateWarn(state: StateCore, message: string): VFileMessage | undefined { const vfile = state.env.vfile as VFile | undefined; if (!vfile) return; return vfile.message(message); diff --git a/packages/myst-execute/src/transform.ts b/packages/myst-execute/src/transform.ts index 6d61e2d94..9aac044d0 100644 --- a/packages/myst-execute/src/transform.ts +++ b/packages/myst-execute/src/transform.ts @@ -97,10 +97,11 @@ export async function kernelExecutionTransform(tree: GenericParent, vfile: VFile // Requre kernelspec otherwise Jupyter doesn't know what kernel to use if (kernelspec === undefined) { - return fileError( + fileError( vfile, `Notebook does not declare the necessary 'kernelspec' frontmatter key required for execution`, ); + return; } // See if we already cached this execution From c56e08daf6245db96d7da28863c5c74014bd9ea9 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Wed, 10 Jun 2026 09:18:26 +0100 Subject: [PATCH 08/14] fix: update lock --- bun.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bun.lock b/bun.lock index d0a5f1249..62d5c2a0f 100644 --- a/bun.lock +++ b/bun.lock @@ -1,6 +1,5 @@ { "lockfileVersion": 1, - "configVersion": 0, "workspaces": { "": { "name": "mystmd", @@ -86,6 +85,7 @@ "dependencies": { "js-yaml": "^4.1.0", "vfile": "^5.3.7", + "vfile-message": "^3.0.0", }, "devDependencies": { "markdown-it-footnote": "^4.0.0", @@ -97,7 +97,7 @@ }, "packages/myst-cli": { "name": "myst-cli", - "version": "1.10.0", + "version": "1.10.1", "dependencies": { "@jupyterlab/services": "^7.3.0", "@reduxjs/toolkit": "^2.1.0", @@ -371,7 +371,7 @@ }, "packages/myst-migrate": { "name": "myst-migrate", - "version": "1.10.0", + "version": "1.10.1", "dependencies": { "unist-util-select": "^4.0.3", "unist-util-visit": "^4.1.2", @@ -624,7 +624,7 @@ }, "packages/mystmd": { "name": "mystmd", - "version": "1.10.0", + "version": "1.10.1", "bin": { "myst": "./dist/myst.cjs", }, From c001ce0e6a08c46ae3732e35efe56348a3de88b7 Mon Sep 17 00:00:00 2001 From: "Tom C (DLS)" <101418278+coretl@users.noreply.github.com> Date: Wed, 10 Jun 2026 12:46:54 +0100 Subject: [PATCH 09/14] Convert pyproject.toml dependencies from approx equal to lower bound (#2948) This allows them to coexist more easily with other python deps in a single venv --- packages/mystmd-py/pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/mystmd-py/pyproject.toml b/packages/mystmd-py/pyproject.toml index adfa77b93..736b0d394 100644 --- a/packages/mystmd-py/pyproject.toml +++ b/packages/mystmd-py/pyproject.toml @@ -43,8 +43,8 @@ env-var = "MYSTMD_PACKAGE_VARIANT" # Ensure that we only bring in nodeenv for PyPI [tool.hatch.build.hooks.selector.variants.pypi] dependencies = [ - "platformdirs~=4.2.2", - "nodeenv~=1.9.1" + "platformdirs>=4.2.2", + "nodeenv>=1.9.1" ] # Conda-forge has no additional dependencies to the `project.dependencies` From 75ab23e712ce0c1c3606699b9dcbd74b5a7addac Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 10 Jun 2026 15:23:40 +0200 Subject: [PATCH 10/14] doc: rephrase how to refer to static files (#2912) * doc: rephrase how to refer to static files * github copilot review * Update docs/website-downloads.md Co-authored-by: Chris Holdgraf --------- Co-authored-by: Chris Holdgraf --- docs/website-downloads.md | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/docs/website-downloads.md b/docs/website-downloads.md index d63a09aad..a2187afe5 100644 --- a/docs/website-downloads.md +++ b/docs/website-downloads.md @@ -38,6 +38,8 @@ For example: Use the `project.static_files` option to copy files or folders into your build output. This is useful when a file needs to keep a predictable name at a known location. +### Declare static files in project configuration (`myst.yml`) + To do so, add a list of paths under `project:` in your `myst.yml`: ```{code-block} yaml @@ -45,23 +47,36 @@ To do so, add a list of paths under `project:` in your `myst.yml`: project: static_files: - - path/to/CNAME # A file name, for example + - path/to/CNAME # A file name, for example - path/to/assets # A folder name, for example ``` -Each entry is copied into the **root** of the build output (`_build/html/`). -The behavior changes slightly based on whether you link to a file or a folder: +### Use static files in your content + +To refer to these files in your content: + +- if you have declared a **specific file** in `static_files`, refer to it as e.g. + + ➡️ `[text](/CNAME)` +- if the file is **inside a folder** declared in `static_files`, refer to it as e.g. + + ➡️ `[text](/assets/image.png)` + +:::{warning} Always use an absolute path +Static files are only accessible by URL from **the root** of the site (e.g. `/CNAME`, `/assets/...`) + +URLs **without an initial slash** - such as `[text](path/to/CNAME)` - +would **produce a "file not found" warning** during the build. +::: + +:::{admonition} How static files are copied in the build +:class: dropdown tip - A **file** path (e.g. `path/to/CNAME`) is copied to the root using only its filename. Parent directories are **not** preserved, so the file ends up at `_build/html/CNAME`. - A **folder** path (e.g. `path/to/assets`) is copied recursively using only the folder's name. As with files, parent directories are **not** preserved, but sub-folder contents are preserved. - The folder and its contents end up at `_build/html/assets/...`. - -:::{note} Linking to static files from Markdown -Static files are accessible by URL in the final build (e.g. `/CNAME`, `/assets/...`), but MyST does not resolve them as content pages. -Markdown links such as `[text](path/to/CNAME)` will produce a "file not found" warning during the build. -To suppress the warning, use an explicit URL path in your link (e.g. `[text](/CNAME)`), or use the {myst:role}`download` role to attach the file as a download link instead. + The folder and its contents end up at `_build/html/assets/...`. ::: :::{note} Want cache busting or a rendered inline link? From 029025f1f98c2bdb35a9a1ad710f4b9ea7b7a479 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Wed, 10 Jun 2026 16:05:33 +0100 Subject: [PATCH 11/14] =?UTF-8?q?=F0=9F=96=A8=EF=B8=8F=20Render=20`myst-sp?= =?UTF-8?q?ec`=20schema=20into=20TypeScript=20(#2914)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/polite-eels-do.md | 5 + bun.lock | 55 +- packages/myst-spec/.gitignore | 3 - .../myst-spec/docs/examples/abbreviation.md | 41 + .../myst-spec/docs/examples/admonition.md | 51 + .../myst-spec/docs/examples/blockbreak.md | 37 + .../myst-spec/docs/examples/blockquote.md | 32 + packages/myst-spec/docs/examples/break.md | 43 + packages/myst-spec/docs/examples/code.md | 33 + packages/myst-spec/docs/examples/comment.md | 40 + packages/myst-spec/docs/examples/container.md | 59 + .../myst-spec/docs/examples/crossreference.md | 86 + packages/myst-spec/docs/examples/directive.md | 44 + packages/myst-spec/docs/examples/footnote.md | 86 + .../myst-spec/docs/examples/formatting.md | 44 + packages/myst-spec/docs/examples/heading.md | 31 + packages/myst-spec/docs/examples/html.md | 28 + packages/myst-spec/docs/examples/image.md | 31 + .../myst-spec/docs/examples/inlinemath.md | 36 + packages/myst-spec/docs/examples/link.md | 34 + packages/myst-spec/docs/examples/list.md | 50 + packages/myst-spec/docs/examples/math.md | 42 + packages/myst-spec/docs/examples/paragraph.md | 30 + packages/myst-spec/docs/examples/role.md | 31 + packages/myst-spec/docs/examples/subscript.md | 40 + .../myst-spec/docs/examples/superscript.md | 40 + packages/myst-spec/docs/examples/table.md | 58 + packages/myst-spec/docs/examples/target.md | 35 + packages/myst-spec/docs/myst.schema.md | 1184 ++++++++++++++ packages/myst-spec/docs/nodes/abbreviation.md | 18 + packages/myst-spec/docs/nodes/admonition.md | 20 + .../myst-spec/docs/nodes/admonitiontitle.md | 14 + packages/myst-spec/docs/nodes/alternative.md | 5 + packages/myst-spec/docs/nodes/association.md | 9 + packages/myst-spec/docs/nodes/block.md | 17 + packages/myst-spec/docs/nodes/blockbreak.md | 14 + packages/myst-spec/docs/nodes/blockquote.md | 12 + packages/myst-spec/docs/nodes/break.md | 11 + packages/myst-spec/docs/nodes/caption.md | 14 + packages/myst-spec/docs/nodes/code.md | 38 + packages/myst-spec/docs/nodes/comment.md | 14 + packages/myst-spec/docs/nodes/container.md | 32 + .../myst-spec/docs/nodes/crossreference.md | 26 + packages/myst-spec/docs/nodes/definition.md | 23 + packages/myst-spec/docs/nodes/directive.md | 26 + packages/myst-spec/docs/nodes/emphasis.md | 14 + .../myst-spec/docs/nodes/emphasisstatic.md | 14 + packages/myst-spec/docs/nodes/flowcontent.md | 1 + .../docs/nodes/footnotedefinition.md | 20 + .../myst-spec/docs/nodes/footnotereference.md | 17 + packages/myst-spec/docs/nodes/heading.md | 27 + packages/myst-spec/docs/nodes/html.md | 14 + packages/myst-spec/docs/nodes/image.md | 29 + .../myst-spec/docs/nodes/imagereference.md | 23 + packages/myst-spec/docs/nodes/inlinecode.md | 14 + packages/myst-spec/docs/nodes/inlinemath.md | 14 + packages/myst-spec/docs/nodes/legend.md | 14 + packages/myst-spec/docs/nodes/link.md | 20 + .../myst-spec/docs/nodes/linkreference.md | 23 + packages/myst-spec/docs/nodes/list.md | 21 + packages/myst-spec/docs/nodes/listcontent.md | 1 + packages/myst-spec/docs/nodes/listitem.md | 15 + packages/myst-spec/docs/nodes/literal.md | 17 + packages/myst-spec/docs/nodes/math.md | 26 + packages/myst-spec/docs/nodes/node.md | 11 + .../docs/nodes/optionalassociation.md | 8 + packages/myst-spec/docs/nodes/paragraph.md | 12 + packages/myst-spec/docs/nodes/parent.md | 17 + .../myst-spec/docs/nodes/phrasingcontent.md | 1 + packages/myst-spec/docs/nodes/point.md | 11 + packages/myst-spec/docs/nodes/position.md | 11 + packages/myst-spec/docs/nodes/reference.md | 8 + packages/myst-spec/docs/nodes/resource.md | 8 + packages/myst-spec/docs/nodes/role.md | 20 + packages/myst-spec/docs/nodes/root.md | 15 + .../docs/nodes/staticphrasingcontent.md | 1 + packages/myst-spec/docs/nodes/strong.md | 14 + packages/myst-spec/docs/nodes/strongstatic.md | 14 + packages/myst-spec/docs/nodes/subscript.md | 14 + .../myst-spec/docs/nodes/subscriptstatic.md | 14 + packages/myst-spec/docs/nodes/superscript.md | 14 + .../myst-spec/docs/nodes/superscriptstatic.md | 14 + packages/myst-spec/docs/nodes/table.md | 17 + packages/myst-spec/docs/nodes/tablecell.md | 20 + packages/myst-spec/docs/nodes/tablerow.md | 14 + packages/myst-spec/docs/nodes/target.md | 14 + packages/myst-spec/docs/nodes/text.md | 12 + .../myst-spec/docs/nodes/thematicbreak.md | 9 + packages/myst-spec/docs/nodes/underline.md | 14 + .../myst-spec/docs/nodes/underlinestatic.md | 14 + packages/myst-spec/index.ts | 407 ----- packages/myst-spec/package.json | 9 +- .../schema/abbreviations.schema.json | 35 - .../myst-spec/schema/admonitions.schema.json | 77 - packages/myst-spec/schema/blocks.schema.json | 72 - .../myst-spec/schema/comments.schema.json | 25 - .../myst-spec/schema/commonmark.schema.json | 593 ------- .../myst-spec/schema/containers.schema.json | 139 -- .../myst-spec/schema/directives.schema.json | 48 - .../myst-spec/schema/footnotes.schema.json | 53 - packages/myst-spec/schema/math.schema.json | 54 - packages/myst-spec/schema/myst.schema.json | 103 -- .../myst-spec/schema/references.schema.json | 60 - packages/myst-spec/schema/roles.schema.json | 39 - packages/myst-spec/schema/schema.spec.ts | 105 -- packages/myst-spec/schema/styles.schema.json | 145 -- packages/myst-spec/schema/tables.schema.json | 88 - packages/myst-spec/schema/unist.schema.json | 108 -- packages/myst-spec/src/index.ts | 1430 +++++++++++++++++ 109 files changed, 4684 insertions(+), 2173 deletions(-) create mode 100644 .changeset/polite-eels-do.md create mode 100644 packages/myst-spec/docs/examples/abbreviation.md create mode 100644 packages/myst-spec/docs/examples/admonition.md create mode 100644 packages/myst-spec/docs/examples/blockbreak.md create mode 100644 packages/myst-spec/docs/examples/blockquote.md create mode 100644 packages/myst-spec/docs/examples/break.md create mode 100644 packages/myst-spec/docs/examples/code.md create mode 100644 packages/myst-spec/docs/examples/comment.md create mode 100644 packages/myst-spec/docs/examples/container.md create mode 100644 packages/myst-spec/docs/examples/crossreference.md create mode 100644 packages/myst-spec/docs/examples/directive.md create mode 100644 packages/myst-spec/docs/examples/footnote.md create mode 100644 packages/myst-spec/docs/examples/formatting.md create mode 100644 packages/myst-spec/docs/examples/heading.md create mode 100644 packages/myst-spec/docs/examples/html.md create mode 100644 packages/myst-spec/docs/examples/image.md create mode 100644 packages/myst-spec/docs/examples/inlinemath.md create mode 100644 packages/myst-spec/docs/examples/link.md create mode 100644 packages/myst-spec/docs/examples/list.md create mode 100644 packages/myst-spec/docs/examples/math.md create mode 100644 packages/myst-spec/docs/examples/paragraph.md create mode 100644 packages/myst-spec/docs/examples/role.md create mode 100644 packages/myst-spec/docs/examples/subscript.md create mode 100644 packages/myst-spec/docs/examples/superscript.md create mode 100644 packages/myst-spec/docs/examples/table.md create mode 100644 packages/myst-spec/docs/examples/target.md create mode 100644 packages/myst-spec/docs/myst.schema.md create mode 100644 packages/myst-spec/docs/nodes/abbreviation.md create mode 100644 packages/myst-spec/docs/nodes/admonition.md create mode 100644 packages/myst-spec/docs/nodes/admonitiontitle.md create mode 100644 packages/myst-spec/docs/nodes/alternative.md create mode 100644 packages/myst-spec/docs/nodes/association.md create mode 100644 packages/myst-spec/docs/nodes/block.md create mode 100644 packages/myst-spec/docs/nodes/blockbreak.md create mode 100644 packages/myst-spec/docs/nodes/blockquote.md create mode 100644 packages/myst-spec/docs/nodes/break.md create mode 100644 packages/myst-spec/docs/nodes/caption.md create mode 100644 packages/myst-spec/docs/nodes/code.md create mode 100644 packages/myst-spec/docs/nodes/comment.md create mode 100644 packages/myst-spec/docs/nodes/container.md create mode 100644 packages/myst-spec/docs/nodes/crossreference.md create mode 100644 packages/myst-spec/docs/nodes/definition.md create mode 100644 packages/myst-spec/docs/nodes/directive.md create mode 100644 packages/myst-spec/docs/nodes/emphasis.md create mode 100644 packages/myst-spec/docs/nodes/emphasisstatic.md create mode 100644 packages/myst-spec/docs/nodes/flowcontent.md create mode 100644 packages/myst-spec/docs/nodes/footnotedefinition.md create mode 100644 packages/myst-spec/docs/nodes/footnotereference.md create mode 100644 packages/myst-spec/docs/nodes/heading.md create mode 100644 packages/myst-spec/docs/nodes/html.md create mode 100644 packages/myst-spec/docs/nodes/image.md create mode 100644 packages/myst-spec/docs/nodes/imagereference.md create mode 100644 packages/myst-spec/docs/nodes/inlinecode.md create mode 100644 packages/myst-spec/docs/nodes/inlinemath.md create mode 100644 packages/myst-spec/docs/nodes/legend.md create mode 100644 packages/myst-spec/docs/nodes/link.md create mode 100644 packages/myst-spec/docs/nodes/linkreference.md create mode 100644 packages/myst-spec/docs/nodes/list.md create mode 100644 packages/myst-spec/docs/nodes/listcontent.md create mode 100644 packages/myst-spec/docs/nodes/listitem.md create mode 100644 packages/myst-spec/docs/nodes/literal.md create mode 100644 packages/myst-spec/docs/nodes/math.md create mode 100644 packages/myst-spec/docs/nodes/node.md create mode 100644 packages/myst-spec/docs/nodes/optionalassociation.md create mode 100644 packages/myst-spec/docs/nodes/paragraph.md create mode 100644 packages/myst-spec/docs/nodes/parent.md create mode 100644 packages/myst-spec/docs/nodes/phrasingcontent.md create mode 100644 packages/myst-spec/docs/nodes/point.md create mode 100644 packages/myst-spec/docs/nodes/position.md create mode 100644 packages/myst-spec/docs/nodes/reference.md create mode 100644 packages/myst-spec/docs/nodes/resource.md create mode 100644 packages/myst-spec/docs/nodes/role.md create mode 100644 packages/myst-spec/docs/nodes/root.md create mode 100644 packages/myst-spec/docs/nodes/staticphrasingcontent.md create mode 100644 packages/myst-spec/docs/nodes/strong.md create mode 100644 packages/myst-spec/docs/nodes/strongstatic.md create mode 100644 packages/myst-spec/docs/nodes/subscript.md create mode 100644 packages/myst-spec/docs/nodes/subscriptstatic.md create mode 100644 packages/myst-spec/docs/nodes/superscript.md create mode 100644 packages/myst-spec/docs/nodes/superscriptstatic.md create mode 100644 packages/myst-spec/docs/nodes/table.md create mode 100644 packages/myst-spec/docs/nodes/tablecell.md create mode 100644 packages/myst-spec/docs/nodes/tablerow.md create mode 100644 packages/myst-spec/docs/nodes/target.md create mode 100644 packages/myst-spec/docs/nodes/text.md create mode 100644 packages/myst-spec/docs/nodes/thematicbreak.md create mode 100644 packages/myst-spec/docs/nodes/underline.md create mode 100644 packages/myst-spec/docs/nodes/underlinestatic.md delete mode 100644 packages/myst-spec/index.ts delete mode 100644 packages/myst-spec/schema/abbreviations.schema.json delete mode 100644 packages/myst-spec/schema/admonitions.schema.json delete mode 100644 packages/myst-spec/schema/blocks.schema.json delete mode 100644 packages/myst-spec/schema/comments.schema.json delete mode 100644 packages/myst-spec/schema/commonmark.schema.json delete mode 100644 packages/myst-spec/schema/containers.schema.json delete mode 100644 packages/myst-spec/schema/directives.schema.json delete mode 100644 packages/myst-spec/schema/footnotes.schema.json delete mode 100644 packages/myst-spec/schema/math.schema.json delete mode 100644 packages/myst-spec/schema/myst.schema.json delete mode 100644 packages/myst-spec/schema/references.schema.json delete mode 100644 packages/myst-spec/schema/roles.schema.json delete mode 100644 packages/myst-spec/schema/schema.spec.ts delete mode 100644 packages/myst-spec/schema/styles.schema.json delete mode 100644 packages/myst-spec/schema/tables.schema.json delete mode 100644 packages/myst-spec/schema/unist.schema.json create mode 100644 packages/myst-spec/src/index.ts diff --git a/.changeset/polite-eels-do.md b/.changeset/polite-eels-do.md new file mode 100644 index 000000000..4bf77e608 --- /dev/null +++ b/.changeset/polite-eels-do.md @@ -0,0 +1,5 @@ +--- +'myst-spec': patch +--- + +Drop JSON Schema pipeline in favour of exported TypeScript diff --git a/bun.lock b/bun.lock index 62d5c2a0f..b03679b93 100644 --- a/bun.lock +++ b/bun.lock @@ -432,10 +432,7 @@ "name": "myst-spec", "version": "0.0.5", "devDependencies": { - "ajv": "^8.17.1", - "ajv-formats": "^3.0.1", - "js-yaml": "^4.1.0", - "json-schema-to-typescript": "^15.0.4", + "copyfiles": "^2.4.1", }, }, "packages/myst-spec-ext": { @@ -670,8 +667,6 @@ "packages": { "@aashutoshrathi/word-wrap": ["@aashutoshrathi/word-wrap@1.2.6", "", {}, "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA=="], - "@apidevtools/json-schema-ref-parser": ["@apidevtools/json-schema-ref-parser@11.9.3", "", { "dependencies": { "@jsdevtools/ono": "^7.1.3", "@types/json-schema": "^7.0.15", "js-yaml": "^4.1.0" } }, "sha512-60vepv88RwcJtSHrD6MjIL6Ta3SOYbgfnkHb+ppAVK+o9mXprRtulx7VlRl3lN3bbvysAfCS7WMVfhUYemB0IQ=="], - "@babel/parser": ["@babel/parser@7.24.4", "", { "bin": { "parser": "bin/babel-parser.js" } }, "sha512-zTvEBcghmeBma9QIGunWevvBAp4/Qu9Bdq+2k0Ot4fVMD6v3dsC9WOcRSKk7tRRyBM/53yKMJko9xOatGQAwSg=="], "@babel/runtime": ["@babel/runtime@7.28.4", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="], @@ -800,8 +795,6 @@ "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], - "@jsdevtools/ono": ["@jsdevtools/ono@7.1.3", "", {}, "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg=="], - "@jupyter/ydoc": ["@jupyter/ydoc@3.1.0", "", { "dependencies": { "@jupyterlab/nbformat": "^3.0.0 || ^4.0.0-alpha.21 || ^4.0.0", "@lumino/coreutils": "^1.11.0 || ^2.0.0", "@lumino/disposable": "^1.10.0 || ^2.0.0", "@lumino/signaling": "^1.10.0 || ^2.0.0", "y-protocols": "^1.0.5", "yjs": "^13.5.40" } }, "sha512-+hLNUBZr8Zz8NiuaoYKINDURDJHbjFGxg8EcSU52y+rBe412TsoFxfPSng4eP7w3cZFrVlm7D+8K0nAMHxj0ZQ=="], "@jupyterlab/coreutils": ["@jupyterlab/coreutils@6.4.8", "", { "dependencies": { "@lumino/coreutils": "^2.2.1", "@lumino/disposable": "^2.1.4", "@lumino/signaling": "^2.1.4", "minimist": "~1.2.0", "path-browserify": "^1.0.0", "url-parse": "~1.5.4" } }, "sha512-y7NGkh31fJaRMDGPfi6uwUeP3eCJrwNSVqmEo0bN9qxiJsysRGOBKPAFuFUS3IKD/au79EwyKHgxhBZxLwiqBQ=="], @@ -960,8 +953,6 @@ "@types/linkify-it": ["@types/linkify-it@3.0.2", "", {}, "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA=="], - "@types/lodash": ["@types/lodash@4.17.21", "", {}, "sha512-FOvQ0YPD5NOfPgMzJihoT+Za5pdkDJWcbpuj1DjaKZIr/gxodQjY/uWEFlTNqW2ugXHUiL8lRQgw63dzKHZdeQ=="], - "@types/markdown-it": ["@types/markdown-it@13.0.9", "", { "dependencies": { "@types/linkify-it": "^3", "@types/mdurl": "^1" } }, "sha512-1XPwR0+MgXLWfTn9gCsZ55AHOKW1WN+P9vr0PaQh5aerR9LLQXUbjfEAFhjmEmyoYFWAyuN2Mqkn40MZ4ukjBw=="], "@types/mdast": ["@types/mdast@3.0.12", "", { "dependencies": { "@types/unist": "^2" } }, "sha512-DT+iNIRNX884cx0/Q1ja7NyUPpZuv0KPyL5rGNxm1WC1OtHstl7n4Jb7nk+xacNShQMbczJjt8uFzznpp6kYBg=="], @@ -1278,6 +1269,8 @@ "cookie-signature": ["cookie-signature@1.0.6", "", {}, "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="], + "copyfiles": ["copyfiles@2.4.1", "", { "dependencies": { "glob": "^7.0.5", "minimatch": "^3.0.3", "mkdirp": "^1.0.4", "noms": "0.0.0", "through2": "^2.0.1", "untildify": "^4.0.0", "yargs": "^16.1.0" }, "bin": { "copyfiles": "copyfiles", "copyup": "copyfiles" } }, "sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg=="], + "core-js": ["core-js@3.31.1", "", {}, "sha512-2sKLtfq1eFST7l7v62zaqXacPc7uG8ZAya8ogijLhTtaKNcpzpB4TMoTw2Si+8GYKRwFPMMtUT0263QFWFfqyQ=="], "core-util-is": ["core-util-is@1.0.3", "", {}, "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="], @@ -1784,8 +1777,6 @@ "json-schema-merge-allof": ["json-schema-merge-allof@0.8.1", "", { "dependencies": { "compute-lcm": "^1.1.2", "json-schema-compare": "^0.2.2", "lodash": "^4.17.20" } }, "sha512-CTUKmIlPJbsWfzRRnOXz+0MjIqvnleIXwFTzz+t9T86HnYX/Rozria6ZVGLktAU9e+NygNljveP+yxqtQp/Q4w=="], - "json-schema-to-typescript": ["json-schema-to-typescript@15.0.4", "", { "dependencies": { "@apidevtools/json-schema-ref-parser": "^11.5.5", "@types/json-schema": "^7.0.15", "@types/lodash": "^4.17.7", "is-glob": "^4.0.3", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "minimist": "^1.2.8", "prettier": "^3.2.5", "tinyglobby": "^0.2.9" }, "bin": { "json2ts": "dist/src/cli.js" } }, "sha512-Su9oK8DR4xCmDsLlyvadkXzX6+GGXJpbhwoLtOGArAG61dvbW4YQmSEno2y66ahpIdmLMg6YUf/QHLgiwvkrHQ=="], - "json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], "json-stable-stringify-without-jsonify": ["json-stable-stringify-without-jsonify@1.0.1", "", {}, "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw=="], @@ -1980,6 +1971,8 @@ "minipass": ["minipass@7.1.2", "", {}, "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw=="], + "mkdirp": ["mkdirp@1.0.4", "", { "bin": { "mkdirp": "bin/cmd.js" } }, "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="], + "module-definition": ["module-definition@3.4.0", "", { "dependencies": { "ast-module-types": "^3.0.0", "node-source-walk": "^4.0.0" }, "bin": "bin/cli.js" }, "sha512-XxJ88R1v458pifaSkPNLUTdSPNVGMP2SXVncVmApGO+gAfrLANiYe6JofymCzVceGOMwQE2xogxBSc8uB7XegA=="], "module-lookup-amd": ["module-lookup-amd@7.0.1", "", { "dependencies": { "commander": "^2.8.1", "debug": "^4.1.0", "glob": "^7.1.6", "requirejs": "^2.3.5", "requirejs-config-file": "^4.0.0" }, "bin": { "lookup-amd": "bin/cli.js" } }, "sha512-w9mCNlj0S8qviuHzpakaLVc+/7q50jl9a/kmJ/n8bmXQZgDPkQHnPBb8MUOYh3WpAYkXuNc2c+khsozhIp/amQ=="], @@ -2072,6 +2065,8 @@ "node-source-walk": ["node-source-walk@5.0.2", "", { "dependencies": { "@babel/parser": "^7.21.4" } }, "sha512-Y4jr/8SRS5hzEdZ7SGuvZGwfORvNsSsNRwDXx5WisiqzsVfeftDvRgfeqWNgZvWSJbgubTRVRYBzK6UO+ErqjA=="], + "noms": ["noms@0.0.0", "", { "dependencies": { "inherits": "^2.0.1", "readable-stream": "~1.0.31" } }, "sha512-lNDU9VJaOPxUmXcLb+HQFeUgQQPtMI24Gt6hgfuMHRJgMRHMF/qZ4HJD3GDru4sSw9IQl2jPjAYnQrdIeLbwow=="], + "normalize-package-data": ["normalize-package-data@2.5.0", "", { "dependencies": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } }, "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA=="], "normalize-path": ["normalize-path@3.0.0", "", {}, "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="], @@ -2430,6 +2425,8 @@ "text-table": ["text-table@0.2.0", "", {}, "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw=="], + "through2": ["through2@2.0.5", "", { "dependencies": { "readable-stream": "~2.3.6", "xtend": "~4.0.1" } }, "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ=="], + "tinybench": ["tinybench@2.9.0", "", {}, "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg=="], "tinyexec": ["tinyexec@0.3.2", "", {}, "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA=="], @@ -2620,6 +2617,8 @@ "xml-js": ["xml-js@1.6.11", "", { "dependencies": { "sax": "^1.2.4" }, "bin": "bin/cli.js" }, "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g=="], + "xtend": ["xtend@4.0.2", "", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="], + "y-protocols": ["y-protocols@1.0.6", "", { "dependencies": { "lib0": "^0.2.85" }, "peerDependencies": { "yjs": "^13.0.0" } }, "sha512-vHRF2L6iT3rwj1jub/K5tYcTT/mEYDUppgNPXwp8fmLpui9f7Yeq3OEtTLVF012j39QnV+KEQpNqoN7CWU7Y9Q=="], "y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="], @@ -2736,6 +2735,10 @@ "concurrently/supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="], + "copyfiles/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], + + "copyfiles/yargs": ["yargs@16.2.0", "", { "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.0", "y18n": "^5.0.5", "yargs-parser": "^20.2.2" } }, "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw=="], + "cross-spawn/semver": ["semver@5.7.2", "", { "bin": "bin/semver" }, "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g=="], "cross-spawn/which": ["which@1.3.1", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": "bin/which" }, "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ=="], @@ -2886,6 +2889,8 @@ "myst-execute/which": ["which@4.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg=="], + "noms/readable-stream": ["readable-stream@1.0.34", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", "isarray": "0.0.1", "string_decoder": "~0.10.x" } }, "sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg=="], + "normalize-package-data/semver": ["semver@5.7.2", "", { "bin": "bin/semver" }, "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g=="], "npm-run-all/chalk": ["chalk@2.4.2", "", { "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ=="], @@ -3052,6 +3057,12 @@ "concurrently/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + "copyfiles/yargs/cliui": ["cliui@7.0.4", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" } }, "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ=="], + + "copyfiles/yargs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], + + "copyfiles/yargs/yargs-parser": ["yargs-parser@20.2.9", "", {}, "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w=="], + "default-browser/execa/cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="], "default-browser/execa/get-stream": ["get-stream@6.0.1", "", {}, "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg=="], @@ -3164,6 +3175,10 @@ "myst-execute/which/isexe": ["isexe@3.1.1", "", {}, "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ=="], + "noms/readable-stream/isarray": ["isarray@0.0.1", "", {}, "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ=="], + + "noms/readable-stream/string_decoder": ["string_decoder@0.10.31", "", {}, "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ=="], + "npm-run-all/chalk/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], "npm-run-all/chalk/supports-color": ["supports-color@5.5.0", "", { "dependencies": { "has-flag": "^3.0.0" } }, "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow=="], @@ -3246,6 +3261,14 @@ "concurrently/chalk/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], + "copyfiles/yargs/cliui/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], + + "copyfiles/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], + + "copyfiles/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], + + "copyfiles/yargs/string-width/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], + "default-browser/execa/cross-spawn/path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="], "default-browser/execa/cross-spawn/shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="], @@ -3308,6 +3331,12 @@ "@manypkg/find-root/find-up/locate-path/p-locate/p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="], + "copyfiles/yargs/cliui/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], + + "copyfiles/yargs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], + + "copyfiles/yargs/string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], + "default-browser/execa/cross-spawn/shebang-command/shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], "intersphinx/myst-cli-utils/chalk/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], @@ -3315,5 +3344,7 @@ "precinct/detective-typescript/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@2.1.0", "", {}, "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw=="], "run-applescript/execa/cross-spawn/shebang-command/shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], + + "copyfiles/yargs/cliui/wrap-ansi/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], } } diff --git a/packages/myst-spec/.gitignore b/packages/myst-spec/.gitignore index c5663c7ac..ff4a819e3 100644 --- a/packages/myst-spec/.gitignore +++ b/packages/myst-spec/.gitignore @@ -1,6 +1,3 @@ index.js docs/_build -docs/examples/*.md -docs/nodes -docs/myst.schema.md diff --git a/packages/myst-spec/docs/examples/abbreviation.md b/packages/myst-spec/docs/examples/abbreviation.md new file mode 100644 index 000000000..c283e265b --- /dev/null +++ b/packages/myst-spec/docs/examples/abbreviation.md @@ -0,0 +1,41 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +Well {abbr}`CSS (Cascading Style Sheets)` is cool? +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: text + value: 'Well ' + - type: mystRole + name: abbr + value: CSS (Cascading Style Sheets) + children: + - type: abbreviation + title: Cascading Style Sheets + children: + - type: text + value: CSS + - type: text + value: ' is cool?' + +``` +```` + +````{tab-item} Render +:sync: render + +Well {abbr}`CSS (Cascading Style Sheets)` is cool? + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/admonition.md b/packages/myst-spec/docs/examples/admonition.md new file mode 100644 index 000000000..52915875d --- /dev/null +++ b/packages/myst-spec/docs/examples/admonition.md @@ -0,0 +1,51 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +```{admonition} This is a title + An example of an admonition with a _title_. +``` +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: mystDirective + name: admonition + args: This is a title + value: An example of an admonition with a _title_. + children: + - type: admonition + children: + - type: admonitionTitle + children: + - type: text + value: This is a title + - type: paragraph + children: + - type: text + value: 'An example of an admonition with a ' + - type: emphasis + children: + - type: text + value: title + - type: text + value: . + +``` +```` + +````{tab-item} Render +:sync: render + +```{admonition} This is a title + An example of an admonition with a _title_. +``` + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/blockbreak.md b/packages/myst-spec/docs/examples/blockbreak.md new file mode 100644 index 000000000..6e806c746 --- /dev/null +++ b/packages/myst-spec/docs/examples/blockbreak.md @@ -0,0 +1,37 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` ++++ +# Heading! ++++ +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: blockBreak + - type: heading + depth: 1 + children: + - type: text + value: Heading! + - type: blockBreak + +``` +```` + +````{tab-item} Render +:sync: render + ++++ +# Heading! ++++ + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/blockquote.md b/packages/myst-spec/docs/examples/blockquote.md new file mode 100644 index 000000000..f2c49a71a --- /dev/null +++ b/packages/myst-spec/docs/examples/blockquote.md @@ -0,0 +1,32 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +> To be or not to be +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: blockquote + children: + - type: paragraph + children: + - type: text + value: To be or not to be + +``` +```` + +````{tab-item} Render +:sync: render + +> To be or not to be + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/break.md b/packages/myst-spec/docs/examples/break.md new file mode 100644 index 000000000..89a43a634 --- /dev/null +++ b/packages/myst-spec/docs/examples/break.md @@ -0,0 +1,43 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +thematic + +--- + +break +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: text + value: thematic + - type: thematicBreak + - type: paragraph + children: + - type: text + value: break + +``` +```` + +````{tab-item} Render +:sync: render + +thematic + +--- + +break + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/code.md b/packages/myst-spec/docs/examples/code.md new file mode 100644 index 000000000..01ec0d12a --- /dev/null +++ b/packages/myst-spec/docs/examples/code.md @@ -0,0 +1,33 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +```python +print('this is python') +``` +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: code + lang: python + value: print('this is python') + +``` +```` + +````{tab-item} Render +:sync: render + +```python +print('this is python') +``` + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/comment.md b/packages/myst-spec/docs/examples/comment.md new file mode 100644 index 000000000..3c519ba84 --- /dev/null +++ b/packages/myst-spec/docs/examples/comment.md @@ -0,0 +1,40 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +Something +% A comment +Something else +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: text + value: Something + - type: mystComment + value: A comment + - type: paragraph + children: + - type: text + value: Something else + +``` +```` + +````{tab-item} Render +:sync: render + +Something +% A comment +Something else + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/container.md b/packages/myst-spec/docs/examples/container.md new file mode 100644 index 000000000..64a4b9e3e --- /dev/null +++ b/packages/myst-spec/docs/examples/container.md @@ -0,0 +1,59 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +```{figure} https://via.placeholder.com/150 +This is the figure caption! + +Something! A legend!? +``` +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: mystDirective + name: figure + args: https://via.placeholder.com/150 + value: |- + This is the figure caption! + + Something! A legend!? + children: + - type: container + kind: figure + children: + - type: image + url: https://via.placeholder.com/150 + - type: caption + children: + - type: paragraph + children: + - type: text + value: This is the figure caption! + - type: legend + children: + - type: paragraph + children: + - type: text + value: Something! A legend!? + +``` +```` + +````{tab-item} Render +:sync: render + +```{figure} https://via.placeholder.com/150 +This is the figure caption! + +Something! A legend!? +``` + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/crossreference.md b/packages/myst-spec/docs/examples/crossreference.md new file mode 100644 index 000000000..479f0c6a4 --- /dev/null +++ b/packages/myst-spec/docs/examples/crossreference.md @@ -0,0 +1,86 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +see {numref}`my-table` + +```{list-table} Caption text +:name: my-table + +* - Head 1 +* - Row 1 +``` +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: text + value: 'see ' + - type: mystRole + name: numref + value: my-table + children: + - type: crossReference + kind: numref + identifier: my-table + label: my-table + - type: mystDirective + name: list-table + args: Caption text + options: + name: my-table + value: |- + * - Head 1 + * - Row 1 + children: + - type: container + kind: table + identifier: my-table + label: my-table + children: + - type: caption + children: + - type: paragraph + children: + - type: text + value: Caption text + - type: table + children: + - type: tableRow + children: + - type: tableCell + children: + - type: text + value: Head 1 + - type: tableRow + children: + - type: tableCell + children: + - type: text + value: Row 1 + +``` +```` + +````{tab-item} Render +:sync: render + +see {numref}`my-table` + +```{list-table} Caption text +:name: my-table + +* - Head 1 +* - Row 1 +``` + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/directive.md b/packages/myst-spec/docs/examples/directive.md new file mode 100644 index 000000000..d44906818 --- /dev/null +++ b/packages/myst-spec/docs/examples/directive.md @@ -0,0 +1,44 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +```{abc} foo bar +:a: one +:b: two + +ABC directive +``` +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: mystDirective + name: abc + args: foo bar + value: |- + :a: one + :b: two + + ABC directive + +``` +```` + +````{tab-item} Render +:sync: render + +```{abc} foo bar +:a: one +:b: two + +ABC directive +``` + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/footnote.md b/packages/myst-spec/docs/examples/footnote.md new file mode 100644 index 000000000..da8c5be73 --- /dev/null +++ b/packages/myst-spec/docs/examples/footnote.md @@ -0,0 +1,86 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +Here's a simple footnote,[^1] and here's a longer one.[^bignote] + +[^1]: This is the first footnote. + +[^bignote]: Here's one with multiple paragraphs and code. + + Indent paragraphs to include them in the footnote. + + `{ my code }` + + Add as many paragraphs as you like. +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: text + value: Here's a simple footnote, + - type: footnoteReference + identifier: '1' + label: '1' + - type: text + value: ' and here''s a longer one.' + - type: footnoteReference + identifier: bignote + label: bignote + - type: footnoteDefinition + identifier: '1' + label: '1' + children: + - type: paragraph + children: + - type: text + value: This is the first footnote. + - type: footnoteDefinition + identifier: bignote + label: bignote + children: + - type: paragraph + children: + - type: text + value: Here's one with multiple paragraphs and code. + - type: paragraph + children: + - type: text + value: Indent paragraphs to include them in the footnote. + - type: paragraph + children: + - type: inlineCode + value: '{ my code }' + - type: paragraph + children: + - type: text + value: Add as many paragraphs as you like. + +``` +```` + +````{tab-item} Render +:sync: render + +Here's a simple footnote,[^1] and here's a longer one.[^bignote] + +[^1]: This is the first footnote. + +[^bignote]: Here's one with multiple paragraphs and code. + + Indent paragraphs to include them in the footnote. + + `{ my code }` + + Add as many paragraphs as you like. + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/formatting.md b/packages/myst-spec/docs/examples/formatting.md new file mode 100644 index 000000000..d4f98e71e --- /dev/null +++ b/packages/myst-spec/docs/examples/formatting.md @@ -0,0 +1,44 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +**strong**, _emphasis_, `literal text`, \*escaped symbols\* +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: strong + children: + - type: text + value: strong + - type: text + value: ', ' + - type: emphasis + children: + - type: text + value: emphasis + - type: text + value: ', ' + - type: inlineCode + value: literal text + - type: text + value: ', *escaped symbols*' + +``` +```` + +````{tab-item} Render +:sync: render + +**strong**, _emphasis_, `literal text`, \*escaped symbols\* + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/heading.md b/packages/myst-spec/docs/examples/heading.md new file mode 100644 index 000000000..5eab6c65f --- /dev/null +++ b/packages/myst-spec/docs/examples/heading.md @@ -0,0 +1,31 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +### Heading! +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: heading + depth: 3 + children: + - type: text + value: Heading! + +``` +```` + +````{tab-item} Render +:sync: render + +### Heading! + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/html.md b/packages/myst-spec/docs/examples/html.md new file mode 100644 index 000000000..4b5e46b9b --- /dev/null +++ b/packages/myst-spec/docs/examples/html.md @@ -0,0 +1,28 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +

*some text*

+```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: html + value:

*some text*

+ +``` +```` + +````{tab-item} Render +:sync: render + +

*some text*

+ +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/image.md b/packages/myst-spec/docs/examples/image.md new file mode 100644 index 000000000..1029af9a9 --- /dev/null +++ b/packages/myst-spec/docs/examples/image.md @@ -0,0 +1,31 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +![fishy](fun-fish.png) +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: image + url: fun-fish.png + alt: fishy + +``` +```` + +````{tab-item} Render +:sync: render + +![fishy](fun-fish.png) + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/inlinemath.md b/packages/myst-spec/docs/examples/inlinemath.md new file mode 100644 index 000000000..203e4c5e6 --- /dev/null +++ b/packages/myst-spec/docs/examples/inlinemath.md @@ -0,0 +1,36 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +This is genius {math}`e=mc^2` +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: text + value: 'This is genius ' + - type: mystRole + name: math + value: e=mc^2 + children: + - type: inlineMath + value: e=mc^2 + +``` +```` + +````{tab-item} Render +:sync: render + +This is genius {math}`e=mc^2` + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/link.md b/packages/myst-spec/docs/examples/link.md new file mode 100644 index 000000000..8c33ee0ca --- /dev/null +++ b/packages/myst-spec/docs/examples/link.md @@ -0,0 +1,34 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +[search engine](https://www.google.com "Google") +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: link + url: https://www.google.com + title: Google + children: + - type: text + value: search engine + +``` +```` + +````{tab-item} Render +:sync: render + +[search engine](https://www.google.com "Google") + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/list.md b/packages/myst-spec/docs/examples/list.md new file mode 100644 index 000000000..102e61fb9 --- /dev/null +++ b/packages/myst-spec/docs/examples/list.md @@ -0,0 +1,50 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +1. quotes +2. breaks +3. links +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: list + ordered: true + start: 1 + spread: false + children: + - type: listItem + spread: true + children: + - type: text + value: quotes + - type: listItem + spread: true + children: + - type: text + value: breaks + - type: listItem + spread: true + children: + - type: text + value: links + +``` +```` + +````{tab-item} Render +:sync: render + +1. quotes +2. breaks +3. links + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/math.md b/packages/myst-spec/docs/examples/math.md new file mode 100644 index 000000000..61f312f0f --- /dev/null +++ b/packages/myst-spec/docs/examples/math.md @@ -0,0 +1,42 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +```{math} +:label: matrix +Ax = b +``` +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: mystDirective + name: math + options: + label: matrix + value: Ax = b + children: + - type: math + identifier: matrix + label: matrix + value: Ax = b + +``` +```` + +````{tab-item} Render +:sync: render + +```{math} +:label: matrix +Ax = b +``` + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/paragraph.md b/packages/myst-spec/docs/examples/paragraph.md new file mode 100644 index 000000000..e3dd6cbdb --- /dev/null +++ b/packages/myst-spec/docs/examples/paragraph.md @@ -0,0 +1,30 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +Something +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: text + value: Something + +``` +```` + +````{tab-item} Render +:sync: render + +Something + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/role.md b/packages/myst-spec/docs/examples/role.md new file mode 100644 index 000000000..51b9bd42c --- /dev/null +++ b/packages/myst-spec/docs/examples/role.md @@ -0,0 +1,31 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +{abc}`ABC role` +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: mystRole + name: abc + value: ABC role + +``` +```` + +````{tab-item} Render +:sync: render + +{abc}`ABC role` + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/subscript.md b/packages/myst-spec/docs/examples/subscript.md new file mode 100644 index 000000000..e68339b84 --- /dev/null +++ b/packages/myst-spec/docs/examples/subscript.md @@ -0,0 +1,40 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +H{subscript}`2`O +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: text + value: H + - type: mystRole + name: subscript + value: '2' + children: + - type: subscript + children: + - type: text + value: '2' + - type: text + value: O + +``` +```` + +````{tab-item} Render +:sync: render + +H{subscript}`2`O + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/superscript.md b/packages/myst-spec/docs/examples/superscript.md new file mode 100644 index 000000000..07a0360d5 --- /dev/null +++ b/packages/myst-spec/docs/examples/superscript.md @@ -0,0 +1,40 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +4{superscript}`th` of July +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: paragraph + children: + - type: text + value: '4' + - type: mystRole + name: superscript + value: th + children: + - type: superscript + children: + - type: text + value: th + - type: text + value: ' of July' + +``` +```` + +````{tab-item} Render +:sync: render + +4{superscript}`th` of July + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/table.md b/packages/myst-spec/docs/examples/table.md new file mode 100644 index 000000000..b88379b58 --- /dev/null +++ b/packages/myst-spec/docs/examples/table.md @@ -0,0 +1,58 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +| header 1 | header 2 | +|:---|---:| +| 3 | 4 | +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: table + children: + - type: tableRow + children: + - type: tableCell + header: true + align: left + children: + - type: text + value: header 1 + - type: tableCell + header: true + align: right + children: + - type: text + value: header 2 + - type: tableRow + children: + - type: tableCell + align: left + children: + - type: text + value: '3' + - type: tableCell + align: right + children: + - type: text + value: '4' + +``` +```` + +````{tab-item} Render +:sync: render + +| header 1 | header 2 | +|:---|---:| +| 3 | 4 | + +```` + +`````` + diff --git a/packages/myst-spec/docs/examples/target.md b/packages/myst-spec/docs/examples/target.md new file mode 100644 index 000000000..2b5f3f804 --- /dev/null +++ b/packages/myst-spec/docs/examples/target.md @@ -0,0 +1,35 @@ +``````{tab-set} +`````{tab-item} Markup +:sync: myst +```` +(my_ID)= +# My Header +```` +````` + +````{tab-item} AST +:sync: ast +```yaml +type: root +children: + - type: mystTarget + label: my_ID + - type: heading + depth: 1 + children: + - type: text + value: My Header + +``` +```` + +````{tab-item} Render +:sync: render + +(my_ID)= +# My Header + +```` + +`````` + diff --git a/packages/myst-spec/docs/myst.schema.md b/packages/myst-spec/docs/myst.schema.md new file mode 100644 index 000000000..ea0b18f70 --- /dev/null +++ b/packages/myst-spec/docs/myst.schema.md @@ -0,0 +1,1184 @@ +# Node Type Index + +(flowcontent)= +## FlowContent + +Any of {ref}`paragraph` | {ref}`definition` | {ref}`heading` | {ref}`thematicbreak` | {ref}`blockquote` | {ref}`list` | {ref}`html` | {ref}`code` | {ref}`comment` | {ref}`target` | {ref}`directive` | {ref}`admonition` | {ref}`container` | {ref}`math` | {ref}`table` | {ref}`footnotedefinition` + +(listcontent)= +## ListContent + +Only {ref}`listitem` + +(phrasingcontent)= +## PhrasingContent + +Any of {ref}`staticphrasingcontent` | {ref}`emphasis` | {ref}`strong` | {ref}`link` | {ref}`linkreference` | {ref}`subscript` | {ref}`superscript` | {ref}`underline` | {ref}`abbreviation` | {ref}`crossreference` | {ref}`footnotereference` + +(staticphrasingcontent)= +## StaticPhrasingContent + +Any of {ref}`text` | {ref}`html` | {ref}`emphasisstatic` | {ref}`strongstatic` | {ref}`inlinecode` | {ref}`break` | {ref}`image` | {ref}`imagereference` | {ref}`role` | {ref}`subscriptstatic` | {ref}`superscriptstatic` | {ref}`underlinestatic` | {ref}`inlinemath` + +(blockbreak)= +## BlockBreak + +Top-level break in the myst document, breaking it into Blocks + +__type__: _string_, ("blockBreak") +: See also {ref}`node` + +__meta__: _string_, _optional_ +: Block metadata. Conventionally this is a stringified JSON dictionary but it may be any arbitrary string. + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(block)= +## Block + +Top-level content blocks or cells the myst document, delimited by BlockBreaks + +__type__: _string_, ("block") +: See also {ref}`node` + +__meta__: _string_, _optional_ +: block metadata from preceding break; conventionally, a stringified JSON dictionary but may be any arbitrary string + +__children__: _array_, _optional_, ({ref}`flowcontent` | {ref}`listcontent` | {ref}`phrasingcontent`) +: Top-level children of myst document + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(role)= +## Role + +Custom in-line behavior + +__type__: _string_, ("mystRole") +: See also {ref}`node` + +__name__: _string_ +: No description for this property. + +__value__: _string_, _optional_ +: content of the directive + +__children__: _array_, _optional_, ({ref}`phrasingcontent`) +: parsed role content + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(directive)= +## Directive + +Content block with predefined behavior + +__type__: _string_, ("mystDirective") +: See also {ref}`node` + +__name__: _string_ +: No description for this property. + +__args__: _string_, _optional_ +: No description for this property. + +__options__: _object_, _optional_ +: No description for this property. + +__value__: _string_, _optional_ +: body of the directive, excluding options + +__children__: _array_, _optional_, ({ref}`flowcontent` | {ref}`phrasingcontent`) +: parsed directive content + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(target)= +## Target + +Target node - provides identifier/label for the following node + +__type__: _string_, ("mystTarget") +: See also {ref}`node` + +__label__: _string_, _optional_ +: unresolved target label + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(crossreference)= +## CrossReference + +In-line reference to an associated node + +__type__: _string_, ("crossReference") +: See also {ref}`node` + +__kind__: _string_, _optional_, ("eq" | "numref" | "ref") +: Indicates if the references should be numbered. + ```{warning} + The `kind` was based on docutils and is subject to change as we improve the `crossReference` experience. + ``` + +__children__: _array_, _optional_, ({ref}`staticphrasingcontent`) +: Children of the crossReference, can include text with "%s" or "{number}" and enumerated references will be filled in. + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(abbreviation)= +## Abbreviation + +Abbreviation node described by title + +__type__: _string_, ("abbreviation") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: abbreviated value +: See also {ref}`parent` + +__title__: _string_, _optional_ +: advisory information for the abbreviation + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(admonition)= +## Admonition + +Admonition node for drawing attention to text, separate from the neighboring content + +__type__: _string_, ("admonition") +: See also {ref}`node` + +__kind__: _string_, _optional_, ("attention" | "caution" | "danger" | "error" | "hint" | "important" | "note" | "seealso" | "tip" | "warning") +: kind of admonition, to determine styling + +__class__: _string_, _optional_ +: admonition class info to override kind + +__children__: _array_, _optional_, ({ref}`admonitiontitle` | {ref}`flowcontent`) +: An optional `admonitionTitle` followed by the admonitions content. + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(admonitiontitle)= +## AdmonitionTitle + +Custom title for admonition, replaces kind as title + +__type__: _string_, ("admonitionTitle") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(container)= +## Container + +Top-level container node to provide association and numbering to child content + +__type__: _string_, ("container") +: See also {ref}`node` + +__kind__: _string_, ("figure" | "table") +: kind of container contents + +__class__: _string_, _optional_ +: any custom class information + +__enumerated__: _boolean_, _optional_ +: count this container for numbering based on kind, e.g. Figure 1a + +__enumerator__: _string_, _optional_ +: resolved enumerated value for this container + +__children__: _array_, ({ref}`caption` | {ref}`legend` | {ref}`image` | {ref}`table`) +: See also {ref}`parent` + +__identifier__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(caption)= +## Caption + +Caption for container content + +__type__: _string_, ("caption") +: See also {ref}`node` + +__children__: _array_, ({ref}`flowcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(legend)= +## Legend + +Legend for container content + +__type__: _string_, ("legend") +: See also {ref}`node` + +__children__: _array_, ({ref}`flowcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(footnotereference)= +## FootnoteReference + +Inline reference to footnote + +__type__: _string_, ("footnoteReference") +: See also {ref}`node` + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(footnotedefinition)= +## FootnoteDefinition + +Rich footnote content associated with footnote reference + +__type__: _string_, ("footnoteDefinition") +: See also {ref}`node` + +__children__: _array_, ({ref}`flowcontent`) +: See also {ref}`parent` + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(math)= +## Math + +Math node for presenting numbered equations + +__type__: _string_, ("math") +: See also {ref}`node` + +__enumerated__: _boolean_, _optional_ +: count this math block for numbering based on kind, e.g. See equation (1a) + +__enumerator__: _string_, _optional_ +: resolved enumerated value for this math block + +__identifier__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(inlinemath)= +## InlineMath + +Fragment of math, similar to InlineCode, using role {math} + +__type__: _string_, ("inlineMath") +: See also {ref}`node` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(table)= +## Table + +Two-dimensional table data + +__type__: _string_, ("table") +: See also {ref}`node` + +__align__: _string_, _optional_, ("left" | "center" | "right") +: No description for this property. + +__children__: _array_, ({ref}`tablerow`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(tablerow)= +## TableRow + +One row of table containing cells + +__type__: _string_, ("tableRow") +: See also {ref}`node` + +__children__: _array_, ({ref}`tablecell`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(tablecell)= +## TableCell + +One cell of table + +__type__: _string_, ("tableCell") +: See also {ref}`node` + +__header__: _boolean_, _optional_ +: No description for this property. + +__align__: _string_, _optional_, ("left" | "center" | "right") +: alignment of content within cell + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(subscript)= +## Subscript + +Subscript content, using role {subscript} + +__type__: _string_, ("subscript") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(subscriptstatic)= +## SubscriptStatic + +Subscript content, with static children; used when parent node requires static content + +__type__: _string_, ("subscript") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(superscript)= +## Superscript + +Superscript content, using role {superscript} + +__type__: _string_, ("superscript") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(superscriptstatic)= +## SuperscriptStatic + +Superscript content, with static children; used when parent node requires static content + +__type__: _string_, ("superscript") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(underline)= +## Underline + +Underline content, using role {underline} + +__type__: _string_, ("underline") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(underlinestatic)= +## UnderlineStatic + +Underline content, with static children; used when parent node requires static content + +__type__: _string_, ("underline") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(comment)= +## Comment + +Comment nodes for comments present in myst but ignored upon render + +__type__: _string_, ("mystComment") +: See also {ref}`node` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(paragraph)= +## Paragraph + +__type__: _string_, ("paragraph") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(heading)= +## Heading + +__type__: _string_, ("heading") +: See also {ref}`node` + +__depth__: _integer_ +: No description for this property. + +__enumerated__: _boolean_, _optional_ +: count this heading for numbering based on kind, e.g. Section 2.4.1 + +__enumerator__: _string_, _optional_ +: resolved enumerated value for this heading + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__identifier__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(thematicbreak)= +## ThematicBreak + +__type__: _string_, ("thematicBreak") +: See also {ref}`node` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(blockquote)= +## Blockquote + +__type__: _string_, ("blockquote") +: See also {ref}`node` + +__children__: _array_, ({ref}`flowcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(list)= +## List + +__type__: _string_, ("list") +: See also {ref}`node` + +__ordered__: _boolean_, _optional_ +: Is item order important or not? + +__start__: _integer_, _optional_ +: Starting number of ordered list + +__spread__: _boolean_, _optional_ +: One or more children are separated with a blank line from others + +__children__: _array_, ({ref}`listcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(listitem)= +## ListItem + +__type__: _string_, ("listItem") +: See also {ref}`node` + +__spread__: _boolean_, _optional_ +: One or more children are separated with a blank line from others + +__children__: _array_, ({ref}`phrasingcontent` | {ref}`flowcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(html)= +## HTML + +Fragment of raw HTML - does not need to be valid or complete + +__type__: _string_, ("html") +: See also {ref}`node` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(code)= +## Code + +Block of preformatted text + +__type__: _string_, ("code") +: See also {ref}`node` + +__lang__: _string_, _optional_ +: language of the code + +__meta__: _string_, _optional_ +: custom information relating to the node + +__class__: _string_, _optional_ +: user-defined class for code block + +__showLineNumbers__: _boolean_, _optional_ +: No description for this property. + +__startingLineNumber__: _integer_, _optional_ +: No description for this property. + +__emphasizeLines__: _array_, _optional_, (integer) +: No description for this property. + +__identifier__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(definition)= +## Definition + +Reference to a url resource + +__type__: _string_, ("definition") +: See also {ref}`node` + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__url__: _string_ +: See also {ref}`resource` + +__title__: _string_, _optional_ +: See also {ref}`resource` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(text)= +## Text + +__type__: _string_, ("text") +: See also {ref}`node` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(emphasis)= +## Emphasis + +Stressed, italicized content + +__type__: _string_, ("emphasis") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(emphasisstatic)= +## EmphasisStatic + +Stressed, italicized content, with static children; used when parent node requires static content + +__type__: _string_, ("emphasis") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(strong)= +## Strong + +Important, serious, urgent, bold content + +__type__: _string_, ("strong") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(strongstatic)= +## StrongStatic + +Important, serious, urgent, bold content, with static children; used when parent node requires static content + +__type__: _string_, ("strong") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(inlinecode)= +## InlineCode + +Fragment of code + +__type__: _string_, ("inlineCode") +: See also {ref}`node` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(break)= +## Break + +Line break + +__type__: _string_, ("break") +: See also {ref}`node` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(link)= +## Link + +Hyperlink + +__type__: _string_, ("link") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__url__: _string_ +: See also {ref}`resource` + +__title__: _string_, _optional_ +: See also {ref}`resource` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(image)= +## Image + +Image hyperlink + +__type__: _string_, ("image") +: See also {ref}`node` + +__class__: _string_, _optional_ +: user-defined class for image + +__width__: _string_, _optional_ +: image width in pixels or percentage + +__align__: _string_, _optional_, ("left" | "center" | "right") +: No description for this property. + +__url__: _string_ +: See also {ref}`resource` + +__title__: _string_, _optional_ +: See also {ref}`resource` + +__alt__: _string_, _optional_ +: See also {ref}`alternative` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(linkreference)= +## LinkReference + +Hyperlink through association + +__type__: _string_, ("linkReference") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__referenceType__: _string_, ("shortcut" | "collapsed" | "full") +: See also {ref}`reference` + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(imagereference)= +## ImageReference + +Image through association + +__type__: _string_, ("imageReference") +: See also {ref}`node` + +__referenceType__: _string_, ("shortcut" | "collapsed" | "full") +: See also {ref}`reference` + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__alt__: _string_, _optional_ +: See also {ref}`alternative` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + +(resource)= +## Resource + +Reference to external resource + +__url__: _string_ +: A Uniform Resource Locator (URL) to an external resource or link. + +__title__: _string_, _optional_ +: advisory information, e.g. for a tooltip + + +(optionalassociation)= +## OptionalAssociation + +Internal relation from one node to another; not required by node + +__identifier__: _string_, _optional_ +: identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + +__label__: _string_, _optional_ +: node label; character escapes and references are parsed; may be normalized to a unique identifier + + +(association)= +## Association + +Internal relation from one node to another + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: node label; character escapes and references are parsed; may be normalized to a unique identifier +: See also {ref}`optionalassociation` + + +(alternative)= +## Alternative + +Alternative description of image + +__alt__: _string_, _optional_ +: field describing the image + + +(reference)= +## Reference + +Marker associated to another node + +__referenceType__: _string_, ("shortcut" | "collapsed" | "full") +: explicitness of the reference: + `shortcut` - reference is implicit, identifier inferred + `collapsed` - reference explicit, identifier inferred + `full` - reference explicit, identifier explicit + + +(node)= +## Node + +Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + +__type__: _string_ +: identifier for node variant + +__data__: _object_, _optional_ +: information associated by the ecosystem with the node; never specified by mdast + +__position__: _object_, _optional_, ({ref}`position`) +: location of node in source file; must not be present for generated nodes + + +(literal)= +## Literal + +Basic node with required string value + +__value__: _string_ +: The value of the node + +__type__: _string_ +: identifier for node variant +: See also {ref}`node` + +__data__: _object_, _optional_ +: information associated by the ecosystem with the node; never specified by mdast +: See also {ref}`node` + +__position__: _object_, _optional_, ({ref}`position`) +: location of node in source file; must not be present for generated nodes +: See also {ref}`node` + + +(parent)= +## Parent + +Basic node with required node children + +__children__: _array_, ({ref}`node`) +: List of children nodes + +__type__: _string_ +: identifier for node variant +: See also {ref}`node` + +__data__: _object_, _optional_ +: information associated by the ecosystem with the node; never specified by mdast +: See also {ref}`node` + +__position__: _object_, _optional_, ({ref}`position`) +: location of node in source file; must not be present for generated nodes +: See also {ref}`node` + + +(point)= +## Point + +One place in a source file + +__line__: _integer_ +: line in the source file, 1-indexed + +__column__: _integer_ +: column in the source file, 1-indexed + +__offset__: _integer_, _optional_ +: offset character in the source file, 0-indexed + + +(position)= +## Position + +Location of a node in a source file + +__start__: _object_, ({ref}`point`) +: place of first character of parsed source region + +__end__: _object_, ({ref}`point`) +: place of first character after parsed source region, whether it exists or not + +__indent__: _array_, _optional_, (integer) +: start column at each index in the source region, for elements that span multiple lines + + +(root)= +## Root + +Myst syntax tree built on existing mdast schemas + +__type__: _string_, ("root") +: See also {ref}`node` + +__children__: _array_, ({ref}`block` | {ref}`blockbreak` | {ref}`flowcontent`) +: Top-level children of myst document +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + + diff --git a/packages/myst-spec/docs/nodes/abbreviation.md b/packages/myst-spec/docs/nodes/abbreviation.md new file mode 100644 index 000000000..8b9841c86 --- /dev/null +++ b/packages/myst-spec/docs/nodes/abbreviation.md @@ -0,0 +1,18 @@ +Abbreviation node described by title + +__type__: _string_, ("abbreviation") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: abbreviated value +: See also {ref}`parent` + +__title__: _string_, _optional_ +: advisory information for the abbreviation + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/admonition.md b/packages/myst-spec/docs/nodes/admonition.md new file mode 100644 index 000000000..347efccb0 --- /dev/null +++ b/packages/myst-spec/docs/nodes/admonition.md @@ -0,0 +1,20 @@ +Admonition node for drawing attention to text, separate from the neighboring content + +__type__: _string_, ("admonition") +: See also {ref}`node` + +__kind__: _string_, _optional_, ("attention" | "caution" | "danger" | "error" | "hint" | "important" | "note" | "seealso" | "tip" | "warning") +: kind of admonition, to determine styling + +__class__: _string_, _optional_ +: admonition class info to override kind + +__children__: _array_, _optional_, ({ref}`admonitiontitle` | {ref}`flowcontent`) +: An optional `admonitionTitle` followed by the admonitions content. + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/admonitiontitle.md b/packages/myst-spec/docs/nodes/admonitiontitle.md new file mode 100644 index 000000000..a9220b7c3 --- /dev/null +++ b/packages/myst-spec/docs/nodes/admonitiontitle.md @@ -0,0 +1,14 @@ +Custom title for admonition, replaces kind as title + +__type__: _string_, ("admonitionTitle") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/alternative.md b/packages/myst-spec/docs/nodes/alternative.md new file mode 100644 index 000000000..21c268b61 --- /dev/null +++ b/packages/myst-spec/docs/nodes/alternative.md @@ -0,0 +1,5 @@ +Alternative description of image + +__alt__: _string_, _optional_ +: field describing the image + diff --git a/packages/myst-spec/docs/nodes/association.md b/packages/myst-spec/docs/nodes/association.md new file mode 100644 index 000000000..893da6f6f --- /dev/null +++ b/packages/myst-spec/docs/nodes/association.md @@ -0,0 +1,9 @@ +Internal relation from one node to another + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: node label; character escapes and references are parsed; may be normalized to a unique identifier +: See also {ref}`optionalassociation` + diff --git a/packages/myst-spec/docs/nodes/block.md b/packages/myst-spec/docs/nodes/block.md new file mode 100644 index 000000000..8ab5e6ea7 --- /dev/null +++ b/packages/myst-spec/docs/nodes/block.md @@ -0,0 +1,17 @@ +Top-level content blocks or cells the myst document, delimited by BlockBreaks + +__type__: _string_, ("block") +: See also {ref}`node` + +__meta__: _string_, _optional_ +: block metadata from preceding break; conventionally, a stringified JSON dictionary but may be any arbitrary string + +__children__: _array_, _optional_, ({ref}`flowcontent` | {ref}`listcontent` | {ref}`phrasingcontent`) +: Top-level children of myst document + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/blockbreak.md b/packages/myst-spec/docs/nodes/blockbreak.md new file mode 100644 index 000000000..da9875c53 --- /dev/null +++ b/packages/myst-spec/docs/nodes/blockbreak.md @@ -0,0 +1,14 @@ +Top-level break in the myst document, breaking it into Blocks + +__type__: _string_, ("blockBreak") +: See also {ref}`node` + +__meta__: _string_, _optional_ +: Block metadata. Conventionally this is a stringified JSON dictionary but it may be any arbitrary string. + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/blockquote.md b/packages/myst-spec/docs/nodes/blockquote.md new file mode 100644 index 000000000..a79c5bb9e --- /dev/null +++ b/packages/myst-spec/docs/nodes/blockquote.md @@ -0,0 +1,12 @@ +__type__: _string_, ("blockquote") +: See also {ref}`node` + +__children__: _array_, ({ref}`flowcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/break.md b/packages/myst-spec/docs/nodes/break.md new file mode 100644 index 000000000..394ae69f1 --- /dev/null +++ b/packages/myst-spec/docs/nodes/break.md @@ -0,0 +1,11 @@ +Line break + +__type__: _string_, ("break") +: See also {ref}`node` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/caption.md b/packages/myst-spec/docs/nodes/caption.md new file mode 100644 index 000000000..6c4c68bbb --- /dev/null +++ b/packages/myst-spec/docs/nodes/caption.md @@ -0,0 +1,14 @@ +Caption for container content + +__type__: _string_, ("caption") +: See also {ref}`node` + +__children__: _array_, ({ref}`flowcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/code.md b/packages/myst-spec/docs/nodes/code.md new file mode 100644 index 000000000..20455344f --- /dev/null +++ b/packages/myst-spec/docs/nodes/code.md @@ -0,0 +1,38 @@ +Block of preformatted text + +__type__: _string_, ("code") +: See also {ref}`node` + +__lang__: _string_, _optional_ +: language of the code + +__meta__: _string_, _optional_ +: custom information relating to the node + +__class__: _string_, _optional_ +: user-defined class for code block + +__showLineNumbers__: _boolean_, _optional_ +: No description for this property. + +__startingLineNumber__: _integer_, _optional_ +: No description for this property. + +__emphasizeLines__: _array_, _optional_, (integer) +: No description for this property. + +__identifier__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/comment.md b/packages/myst-spec/docs/nodes/comment.md new file mode 100644 index 000000000..c964e0ae8 --- /dev/null +++ b/packages/myst-spec/docs/nodes/comment.md @@ -0,0 +1,14 @@ +Comment nodes for comments present in myst but ignored upon render + +__type__: _string_, ("mystComment") +: See also {ref}`node` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/container.md b/packages/myst-spec/docs/nodes/container.md new file mode 100644 index 000000000..080c89b6c --- /dev/null +++ b/packages/myst-spec/docs/nodes/container.md @@ -0,0 +1,32 @@ +Top-level container node to provide association and numbering to child content + +__type__: _string_, ("container") +: See also {ref}`node` + +__kind__: _string_, ("figure" | "table") +: kind of container contents + +__class__: _string_, _optional_ +: any custom class information + +__enumerated__: _boolean_, _optional_ +: count this container for numbering based on kind, e.g. Figure 1a + +__enumerator__: _string_, _optional_ +: resolved enumerated value for this container + +__children__: _array_, ({ref}`caption` | {ref}`legend` | {ref}`image` | {ref}`table`) +: See also {ref}`parent` + +__identifier__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/crossreference.md b/packages/myst-spec/docs/nodes/crossreference.md new file mode 100644 index 000000000..82e82bcb8 --- /dev/null +++ b/packages/myst-spec/docs/nodes/crossreference.md @@ -0,0 +1,26 @@ +In-line reference to an associated node + +__type__: _string_, ("crossReference") +: See also {ref}`node` + +__kind__: _string_, _optional_, ("eq" | "numref" | "ref") +: Indicates if the references should be numbered. + ```{warning} + The `kind` was based on docutils and is subject to change as we improve the `crossReference` experience. + ``` + +__children__: _array_, _optional_, ({ref}`staticphrasingcontent`) +: Children of the crossReference, can include text with "%s" or "{number}" and enumerated references will be filled in. + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/definition.md b/packages/myst-spec/docs/nodes/definition.md new file mode 100644 index 000000000..2e5630b8d --- /dev/null +++ b/packages/myst-spec/docs/nodes/definition.md @@ -0,0 +1,23 @@ +Reference to a url resource + +__type__: _string_, ("definition") +: See also {ref}`node` + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__url__: _string_ +: See also {ref}`resource` + +__title__: _string_, _optional_ +: See also {ref}`resource` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/directive.md b/packages/myst-spec/docs/nodes/directive.md new file mode 100644 index 000000000..0173f2d96 --- /dev/null +++ b/packages/myst-spec/docs/nodes/directive.md @@ -0,0 +1,26 @@ +Content block with predefined behavior + +__type__: _string_, ("mystDirective") +: See also {ref}`node` + +__name__: _string_ +: No description for this property. + +__args__: _string_, _optional_ +: No description for this property. + +__options__: _object_, _optional_ +: No description for this property. + +__value__: _string_, _optional_ +: body of the directive, excluding options + +__children__: _array_, _optional_, ({ref}`flowcontent` | {ref}`phrasingcontent`) +: parsed directive content + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/emphasis.md b/packages/myst-spec/docs/nodes/emphasis.md new file mode 100644 index 000000000..4db3f555c --- /dev/null +++ b/packages/myst-spec/docs/nodes/emphasis.md @@ -0,0 +1,14 @@ +Stressed, italicized content + +__type__: _string_, ("emphasis") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/emphasisstatic.md b/packages/myst-spec/docs/nodes/emphasisstatic.md new file mode 100644 index 000000000..98bc7c1d2 --- /dev/null +++ b/packages/myst-spec/docs/nodes/emphasisstatic.md @@ -0,0 +1,14 @@ +Stressed, italicized content, with static children; used when parent node requires static content + +__type__: _string_, ("emphasis") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/flowcontent.md b/packages/myst-spec/docs/nodes/flowcontent.md new file mode 100644 index 000000000..fb5994fce --- /dev/null +++ b/packages/myst-spec/docs/nodes/flowcontent.md @@ -0,0 +1 @@ +Any of {ref}`paragraph` | {ref}`definition` | {ref}`heading` | {ref}`thematicbreak` | {ref}`blockquote` | {ref}`list` | {ref}`html` | {ref}`code` | {ref}`comment` | {ref}`target` | {ref}`directive` | {ref}`admonition` | {ref}`container` | {ref}`math` | {ref}`table` | {ref}`footnotedefinition` diff --git a/packages/myst-spec/docs/nodes/footnotedefinition.md b/packages/myst-spec/docs/nodes/footnotedefinition.md new file mode 100644 index 000000000..40ade6df3 --- /dev/null +++ b/packages/myst-spec/docs/nodes/footnotedefinition.md @@ -0,0 +1,20 @@ +Rich footnote content associated with footnote reference + +__type__: _string_, ("footnoteDefinition") +: See also {ref}`node` + +__children__: _array_, ({ref}`flowcontent`) +: See also {ref}`parent` + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/footnotereference.md b/packages/myst-spec/docs/nodes/footnotereference.md new file mode 100644 index 000000000..8c6ba5e07 --- /dev/null +++ b/packages/myst-spec/docs/nodes/footnotereference.md @@ -0,0 +1,17 @@ +Inline reference to footnote + +__type__: _string_, ("footnoteReference") +: See also {ref}`node` + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/heading.md b/packages/myst-spec/docs/nodes/heading.md new file mode 100644 index 000000000..68c0b6af0 --- /dev/null +++ b/packages/myst-spec/docs/nodes/heading.md @@ -0,0 +1,27 @@ +__type__: _string_, ("heading") +: See also {ref}`node` + +__depth__: _integer_ +: No description for this property. + +__enumerated__: _boolean_, _optional_ +: count this heading for numbering based on kind, e.g. Section 2.4.1 + +__enumerator__: _string_, _optional_ +: resolved enumerated value for this heading + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__identifier__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/html.md b/packages/myst-spec/docs/nodes/html.md new file mode 100644 index 000000000..bd413b5c8 --- /dev/null +++ b/packages/myst-spec/docs/nodes/html.md @@ -0,0 +1,14 @@ +Fragment of raw HTML - does not need to be valid or complete + +__type__: _string_, ("html") +: See also {ref}`node` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/image.md b/packages/myst-spec/docs/nodes/image.md new file mode 100644 index 000000000..047ab0365 --- /dev/null +++ b/packages/myst-spec/docs/nodes/image.md @@ -0,0 +1,29 @@ +Image hyperlink + +__type__: _string_, ("image") +: See also {ref}`node` + +__class__: _string_, _optional_ +: user-defined class for image + +__width__: _string_, _optional_ +: image width in pixels or percentage + +__align__: _string_, _optional_, ("left" | "center" | "right") +: No description for this property. + +__url__: _string_ +: See also {ref}`resource` + +__title__: _string_, _optional_ +: See also {ref}`resource` + +__alt__: _string_, _optional_ +: See also {ref}`alternative` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/imagereference.md b/packages/myst-spec/docs/nodes/imagereference.md new file mode 100644 index 000000000..37d20eb36 --- /dev/null +++ b/packages/myst-spec/docs/nodes/imagereference.md @@ -0,0 +1,23 @@ +Image through association + +__type__: _string_, ("imageReference") +: See also {ref}`node` + +__referenceType__: _string_, ("shortcut" | "collapsed" | "full") +: See also {ref}`reference` + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__alt__: _string_, _optional_ +: See also {ref}`alternative` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/inlinecode.md b/packages/myst-spec/docs/nodes/inlinecode.md new file mode 100644 index 000000000..affd905fb --- /dev/null +++ b/packages/myst-spec/docs/nodes/inlinecode.md @@ -0,0 +1,14 @@ +Fragment of code + +__type__: _string_, ("inlineCode") +: See also {ref}`node` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/inlinemath.md b/packages/myst-spec/docs/nodes/inlinemath.md new file mode 100644 index 000000000..a79142f24 --- /dev/null +++ b/packages/myst-spec/docs/nodes/inlinemath.md @@ -0,0 +1,14 @@ +Fragment of math, similar to InlineCode, using role {math} + +__type__: _string_, ("inlineMath") +: See also {ref}`node` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/legend.md b/packages/myst-spec/docs/nodes/legend.md new file mode 100644 index 000000000..8e7adae35 --- /dev/null +++ b/packages/myst-spec/docs/nodes/legend.md @@ -0,0 +1,14 @@ +Legend for container content + +__type__: _string_, ("legend") +: See also {ref}`node` + +__children__: _array_, ({ref}`flowcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/link.md b/packages/myst-spec/docs/nodes/link.md new file mode 100644 index 000000000..0674d0405 --- /dev/null +++ b/packages/myst-spec/docs/nodes/link.md @@ -0,0 +1,20 @@ +Hyperlink + +__type__: _string_, ("link") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__url__: _string_ +: See also {ref}`resource` + +__title__: _string_, _optional_ +: See also {ref}`resource` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/linkreference.md b/packages/myst-spec/docs/nodes/linkreference.md new file mode 100644 index 000000000..26a339483 --- /dev/null +++ b/packages/myst-spec/docs/nodes/linkreference.md @@ -0,0 +1,23 @@ +Hyperlink through association + +__type__: _string_, ("linkReference") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__referenceType__: _string_, ("shortcut" | "collapsed" | "full") +: See also {ref}`reference` + +__identifier__: _string_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/list.md b/packages/myst-spec/docs/nodes/list.md new file mode 100644 index 000000000..f7ec959fe --- /dev/null +++ b/packages/myst-spec/docs/nodes/list.md @@ -0,0 +1,21 @@ +__type__: _string_, ("list") +: See also {ref}`node` + +__ordered__: _boolean_, _optional_ +: Is item order important or not? + +__start__: _integer_, _optional_ +: Starting number of ordered list + +__spread__: _boolean_, _optional_ +: One or more children are separated with a blank line from others + +__children__: _array_, ({ref}`listcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/listcontent.md b/packages/myst-spec/docs/nodes/listcontent.md new file mode 100644 index 000000000..bdae201c5 --- /dev/null +++ b/packages/myst-spec/docs/nodes/listcontent.md @@ -0,0 +1 @@ +Only {ref}`listitem` diff --git a/packages/myst-spec/docs/nodes/listitem.md b/packages/myst-spec/docs/nodes/listitem.md new file mode 100644 index 000000000..6ab7d466b --- /dev/null +++ b/packages/myst-spec/docs/nodes/listitem.md @@ -0,0 +1,15 @@ +__type__: _string_, ("listItem") +: See also {ref}`node` + +__spread__: _boolean_, _optional_ +: One or more children are separated with a blank line from others + +__children__: _array_, ({ref}`phrasingcontent` | {ref}`flowcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/literal.md b/packages/myst-spec/docs/nodes/literal.md new file mode 100644 index 000000000..d74cb060d --- /dev/null +++ b/packages/myst-spec/docs/nodes/literal.md @@ -0,0 +1,17 @@ +Basic node with required string value + +__value__: _string_ +: The value of the node + +__type__: _string_ +: identifier for node variant +: See also {ref}`node` + +__data__: _object_, _optional_ +: information associated by the ecosystem with the node; never specified by mdast +: See also {ref}`node` + +__position__: _object_, _optional_, ({ref}`position`) +: location of node in source file; must not be present for generated nodes +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/math.md b/packages/myst-spec/docs/nodes/math.md new file mode 100644 index 000000000..75d14ebae --- /dev/null +++ b/packages/myst-spec/docs/nodes/math.md @@ -0,0 +1,26 @@ +Math node for presenting numbered equations + +__type__: _string_, ("math") +: See also {ref}`node` + +__enumerated__: _boolean_, _optional_ +: count this math block for numbering based on kind, e.g. See equation (1a) + +__enumerator__: _string_, _optional_ +: resolved enumerated value for this math block + +__identifier__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__label__: _string_, _optional_ +: See also {ref}`optionalassociation` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/node.md b/packages/myst-spec/docs/nodes/node.md new file mode 100644 index 000000000..b6284c2bd --- /dev/null +++ b/packages/myst-spec/docs/nodes/node.md @@ -0,0 +1,11 @@ +Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + +__type__: _string_ +: identifier for node variant + +__data__: _object_, _optional_ +: information associated by the ecosystem with the node; never specified by mdast + +__position__: _object_, _optional_, ({ref}`position`) +: location of node in source file; must not be present for generated nodes + diff --git a/packages/myst-spec/docs/nodes/optionalassociation.md b/packages/myst-spec/docs/nodes/optionalassociation.md new file mode 100644 index 000000000..fc138ef84 --- /dev/null +++ b/packages/myst-spec/docs/nodes/optionalassociation.md @@ -0,0 +1,8 @@ +Internal relation from one node to another; not required by node + +__identifier__: _string_, _optional_ +: identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + +__label__: _string_, _optional_ +: node label; character escapes and references are parsed; may be normalized to a unique identifier + diff --git a/packages/myst-spec/docs/nodes/paragraph.md b/packages/myst-spec/docs/nodes/paragraph.md new file mode 100644 index 000000000..aacb3d7e9 --- /dev/null +++ b/packages/myst-spec/docs/nodes/paragraph.md @@ -0,0 +1,12 @@ +__type__: _string_, ("paragraph") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/parent.md b/packages/myst-spec/docs/nodes/parent.md new file mode 100644 index 000000000..420aa7e74 --- /dev/null +++ b/packages/myst-spec/docs/nodes/parent.md @@ -0,0 +1,17 @@ +Basic node with required node children + +__children__: _array_, ({ref}`node`) +: List of children nodes + +__type__: _string_ +: identifier for node variant +: See also {ref}`node` + +__data__: _object_, _optional_ +: information associated by the ecosystem with the node; never specified by mdast +: See also {ref}`node` + +__position__: _object_, _optional_, ({ref}`position`) +: location of node in source file; must not be present for generated nodes +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/phrasingcontent.md b/packages/myst-spec/docs/nodes/phrasingcontent.md new file mode 100644 index 000000000..127d738a8 --- /dev/null +++ b/packages/myst-spec/docs/nodes/phrasingcontent.md @@ -0,0 +1 @@ +Any of {ref}`staticphrasingcontent` | {ref}`emphasis` | {ref}`strong` | {ref}`link` | {ref}`linkreference` | {ref}`subscript` | {ref}`superscript` | {ref}`underline` | {ref}`abbreviation` | {ref}`crossreference` | {ref}`footnotereference` diff --git a/packages/myst-spec/docs/nodes/point.md b/packages/myst-spec/docs/nodes/point.md new file mode 100644 index 000000000..c19177a6c --- /dev/null +++ b/packages/myst-spec/docs/nodes/point.md @@ -0,0 +1,11 @@ +One place in a source file + +__line__: _integer_ +: line in the source file, 1-indexed + +__column__: _integer_ +: column in the source file, 1-indexed + +__offset__: _integer_, _optional_ +: offset character in the source file, 0-indexed + diff --git a/packages/myst-spec/docs/nodes/position.md b/packages/myst-spec/docs/nodes/position.md new file mode 100644 index 000000000..3928b42a3 --- /dev/null +++ b/packages/myst-spec/docs/nodes/position.md @@ -0,0 +1,11 @@ +Location of a node in a source file + +__start__: _object_, ({ref}`point`) +: place of first character of parsed source region + +__end__: _object_, ({ref}`point`) +: place of first character after parsed source region, whether it exists or not + +__indent__: _array_, _optional_, (integer) +: start column at each index in the source region, for elements that span multiple lines + diff --git a/packages/myst-spec/docs/nodes/reference.md b/packages/myst-spec/docs/nodes/reference.md new file mode 100644 index 000000000..c5c984b76 --- /dev/null +++ b/packages/myst-spec/docs/nodes/reference.md @@ -0,0 +1,8 @@ +Marker associated to another node + +__referenceType__: _string_, ("shortcut" | "collapsed" | "full") +: explicitness of the reference: + `shortcut` - reference is implicit, identifier inferred + `collapsed` - reference explicit, identifier inferred + `full` - reference explicit, identifier explicit + diff --git a/packages/myst-spec/docs/nodes/resource.md b/packages/myst-spec/docs/nodes/resource.md new file mode 100644 index 000000000..0259af133 --- /dev/null +++ b/packages/myst-spec/docs/nodes/resource.md @@ -0,0 +1,8 @@ +Reference to external resource + +__url__: _string_ +: A Uniform Resource Locator (URL) to an external resource or link. + +__title__: _string_, _optional_ +: advisory information, e.g. for a tooltip + diff --git a/packages/myst-spec/docs/nodes/role.md b/packages/myst-spec/docs/nodes/role.md new file mode 100644 index 000000000..e2f5c0322 --- /dev/null +++ b/packages/myst-spec/docs/nodes/role.md @@ -0,0 +1,20 @@ +Custom in-line behavior + +__type__: _string_, ("mystRole") +: See also {ref}`node` + +__name__: _string_ +: No description for this property. + +__value__: _string_, _optional_ +: content of the directive + +__children__: _array_, _optional_, ({ref}`phrasingcontent`) +: parsed role content + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/root.md b/packages/myst-spec/docs/nodes/root.md new file mode 100644 index 000000000..4dd9abefa --- /dev/null +++ b/packages/myst-spec/docs/nodes/root.md @@ -0,0 +1,15 @@ +Myst syntax tree built on existing mdast schemas + +__type__: _string_, ("root") +: See also {ref}`node` + +__children__: _array_, ({ref}`block` | {ref}`blockbreak` | {ref}`flowcontent`) +: Top-level children of myst document +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/staticphrasingcontent.md b/packages/myst-spec/docs/nodes/staticphrasingcontent.md new file mode 100644 index 000000000..22c9fd096 --- /dev/null +++ b/packages/myst-spec/docs/nodes/staticphrasingcontent.md @@ -0,0 +1 @@ +Any of {ref}`text` | {ref}`html` | {ref}`emphasisstatic` | {ref}`strongstatic` | {ref}`inlinecode` | {ref}`break` | {ref}`image` | {ref}`imagereference` | {ref}`role` | {ref}`subscriptstatic` | {ref}`superscriptstatic` | {ref}`underlinestatic` | {ref}`inlinemath` diff --git a/packages/myst-spec/docs/nodes/strong.md b/packages/myst-spec/docs/nodes/strong.md new file mode 100644 index 000000000..833703233 --- /dev/null +++ b/packages/myst-spec/docs/nodes/strong.md @@ -0,0 +1,14 @@ +Important, serious, urgent, bold content + +__type__: _string_, ("strong") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/strongstatic.md b/packages/myst-spec/docs/nodes/strongstatic.md new file mode 100644 index 000000000..c8d24f17b --- /dev/null +++ b/packages/myst-spec/docs/nodes/strongstatic.md @@ -0,0 +1,14 @@ +Important, serious, urgent, bold content, with static children; used when parent node requires static content + +__type__: _string_, ("strong") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/subscript.md b/packages/myst-spec/docs/nodes/subscript.md new file mode 100644 index 000000000..229ccf921 --- /dev/null +++ b/packages/myst-spec/docs/nodes/subscript.md @@ -0,0 +1,14 @@ +Subscript content, using role {subscript} + +__type__: _string_, ("subscript") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/subscriptstatic.md b/packages/myst-spec/docs/nodes/subscriptstatic.md new file mode 100644 index 000000000..d39237ddc --- /dev/null +++ b/packages/myst-spec/docs/nodes/subscriptstatic.md @@ -0,0 +1,14 @@ +Subscript content, with static children; used when parent node requires static content + +__type__: _string_, ("subscript") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/superscript.md b/packages/myst-spec/docs/nodes/superscript.md new file mode 100644 index 000000000..8d58d715f --- /dev/null +++ b/packages/myst-spec/docs/nodes/superscript.md @@ -0,0 +1,14 @@ +Superscript content, using role {superscript} + +__type__: _string_, ("superscript") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/superscriptstatic.md b/packages/myst-spec/docs/nodes/superscriptstatic.md new file mode 100644 index 000000000..4c5939496 --- /dev/null +++ b/packages/myst-spec/docs/nodes/superscriptstatic.md @@ -0,0 +1,14 @@ +Superscript content, with static children; used when parent node requires static content + +__type__: _string_, ("superscript") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/table.md b/packages/myst-spec/docs/nodes/table.md new file mode 100644 index 000000000..90dfa51e9 --- /dev/null +++ b/packages/myst-spec/docs/nodes/table.md @@ -0,0 +1,17 @@ +Two-dimensional table data + +__type__: _string_, ("table") +: See also {ref}`node` + +__align__: _string_, _optional_, ("left" | "center" | "right") +: No description for this property. + +__children__: _array_, ({ref}`tablerow`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/tablecell.md b/packages/myst-spec/docs/nodes/tablecell.md new file mode 100644 index 000000000..88111a5c2 --- /dev/null +++ b/packages/myst-spec/docs/nodes/tablecell.md @@ -0,0 +1,20 @@ +One cell of table + +__type__: _string_, ("tableCell") +: See also {ref}`node` + +__header__: _boolean_, _optional_ +: No description for this property. + +__align__: _string_, _optional_, ("left" | "center" | "right") +: alignment of content within cell + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/tablerow.md b/packages/myst-spec/docs/nodes/tablerow.md new file mode 100644 index 000000000..9920eb7e0 --- /dev/null +++ b/packages/myst-spec/docs/nodes/tablerow.md @@ -0,0 +1,14 @@ +One row of table containing cells + +__type__: _string_, ("tableRow") +: See also {ref}`node` + +__children__: _array_, ({ref}`tablecell`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/target.md b/packages/myst-spec/docs/nodes/target.md new file mode 100644 index 000000000..4cbbe1da9 --- /dev/null +++ b/packages/myst-spec/docs/nodes/target.md @@ -0,0 +1,14 @@ +Target node - provides identifier/label for the following node + +__type__: _string_, ("mystTarget") +: See also {ref}`node` + +__label__: _string_, _optional_ +: unresolved target label + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/text.md b/packages/myst-spec/docs/nodes/text.md new file mode 100644 index 000000000..aa97bf495 --- /dev/null +++ b/packages/myst-spec/docs/nodes/text.md @@ -0,0 +1,12 @@ +__type__: _string_, ("text") +: See also {ref}`node` + +__value__: _string_ +: See also {ref}`literal` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/thematicbreak.md b/packages/myst-spec/docs/nodes/thematicbreak.md new file mode 100644 index 000000000..4b14c6565 --- /dev/null +++ b/packages/myst-spec/docs/nodes/thematicbreak.md @@ -0,0 +1,9 @@ +__type__: _string_, ("thematicBreak") +: See also {ref}`node` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/underline.md b/packages/myst-spec/docs/nodes/underline.md new file mode 100644 index 000000000..5989a339f --- /dev/null +++ b/packages/myst-spec/docs/nodes/underline.md @@ -0,0 +1,14 @@ +Underline content, using role {underline} + +__type__: _string_, ("underline") +: See also {ref}`node` + +__children__: _array_, ({ref}`phrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/docs/nodes/underlinestatic.md b/packages/myst-spec/docs/nodes/underlinestatic.md new file mode 100644 index 000000000..62f39bf1c --- /dev/null +++ b/packages/myst-spec/docs/nodes/underlinestatic.md @@ -0,0 +1,14 @@ +Underline content, with static children; used when parent node requires static content + +__type__: _string_, ("underline") +: See also {ref}`node` + +__children__: _array_, ({ref}`staticphrasingcontent`) +: See also {ref}`parent` + +__position__: _object_, _optional_, ({ref}`position`) +: See also {ref}`node` + +__data__: _object_, _optional_ +: See also {ref}`node` + diff --git a/packages/myst-spec/index.ts b/packages/myst-spec/index.ts deleted file mode 100644 index 519df2ea4..000000000 --- a/packages/myst-spec/index.ts +++ /dev/null @@ -1,407 +0,0 @@ -import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'fs'; -import { join } from 'path'; -import { compile } from 'json-schema-to-typescript'; -import { load, dump } from 'js-yaml'; - -const outputSchemaFile = 'myst.schema.json'; -const outputDocFile = 'myst.schema.md'; -const outputTsFile = 'index.d.ts'; -const jsonTestCaseFile = 'myst.tests.json'; - -type PropertyDefinition = { - description?: string; - type?: 'string' | 'number' | 'array' | 'object'; - value?: string | string[]; - from?: string; -}; - -type Properties = Record; - -type PropertyInfo = { - properties: Properties; - required: string[]; -}; - -type Schema = Record; - -function loadSchema(filename: string): Schema { - return JSON.parse(readFileSync(filename, 'utf-8')); -} - -/** - * Mutate schema to make additional properties false everywhere - * - * json-schema-to-typescript will put an additional `[k: string]: any` property - * on every object if additionalProperties is not explicitly `false`. - * Therefore, we iterate through all the definitions and add this flag everywhere. - * Doing this on the original json-schema types would be way too strict, - * but here it works nicely. - */ -function additionalPropsFalse(schema: Schema): void { - for (const key in schema?.$defs) { - schema.$defs[key].additionalProperties = false; - for (const item of schema.$defs[key].allOf || []) { - item.additionalProperties = false; - } - } -} - -/** - * Return new schema where all $refs point to $defs in the current file. - * - * This function assumes all $defs are already present in the current file. - * If we do not have all the $defs in one file, json-schema-to-typescript - * will resolve the references without creating a new type. - */ -function flattenRefs(schema: Schema): Schema { - return JSON.parse(JSON.stringify(schema).replace(/"[a-z]+.schema.json#\//g, '"#/')); -} - -/** - * Mutate schema to allow simpler documentation generation functions - * - * - Use "allOf" for properties on all object definitions - * - Move "Root" definition into $defs - */ -function simplifyForDocGeneration(schema: Schema): void { - for (const key in schema.$defs) { - if (!schema.$defs[key].allOf && schema.$defs[key].properties) { - schema.$defs[key].allOf = [ - { - properties: schema.$defs[key].properties || undefined, - required: schema.$defs[key].required || undefined, - }, - ]; - } - } - schema.$defs.Root = { - description: schema.description, - type: schema.type, - allOf: schema.allOf, - }; -} - -/** - * Simplifies, for example, #/$defs/Caption -> Caption - */ -function typeFromRef(ref?: string): string { - return ref ? ref.split('/')[ref.split('/').length - 1] : ''; -} - -/** - * Converts, for example, #/$defs/Caption -> {ref}`Caption` - */ -function mdReferenceFromRef(ref?: string): string { - return `{ref}\`${typeFromRef(ref).toLowerCase()}\``; -} - -/** - * Build simplified property definitions for markdown from JSON schema "properties" - */ -function definitionsFromProps(props: Schema, from?: string): Properties { - const defs: Properties = {}; - Object.keys(props).forEach((key) => { - const def: PropertyDefinition = { - description: props[key].description, - type: props[key].type, - from, - }; - if (props[key].$ref) { - // "prop": { "$ref": "..."} - def.type = 'object'; - def.value = mdReferenceFromRef(props[key].$ref); - } else if (props[key].const) { - // "prop": {"const": ...} - // Assumption: const properties are always strings - def.type = 'string'; - def.value = `"${props[key].const}"`; - } else if (props[key].type === 'array') { - def.type = 'array'; - if (props[key].items.type) { - // "prop": {"type": "array", "items": { "type": "..."}} - def.value = props[key].items.type; - } else if (props[key].items.$ref) { - // "prop": {"type": "array", "items": { "$ref": "..."}} - def.value = mdReferenceFromRef(props[key].items.$ref); - } else if (props[key].items.anyOf) { - // "prop": {"type": "array", "items": {"anyOf": [{ "$ref": "..."}, { "$ref": "..."}]}} - def.value = props[key].items.anyOf.map((a) => mdReferenceFromRef(a.$ref)); - } - } else if (props[key].anyOf) { - if (props[key].anyOf[0].type === 'array') { - def.type = 'array'; - if (props[key].anyOf[0].items.anyOf) { - // "prop": {"anyOf": [{"type": "array", "items": "anyOf": [{ "$ref": "..."}, { "$ref": "..."}]}, ...]} - // In this case, we ignore everything except the first case. - // In practice, this only occurs with Root nodes, where the first case is - // the most likely to be used. Other cases are mentioned in the description. - def.value = props[key].anyOf[0].items.anyOf.map((a) => mdReferenceFromRef(a.$ref)); - } else { - // "prop": {"anyOf": [{"type": "array", "items": "anyOf": [{ "$ref": "..."}, { "$ref": "..."}]}, ...]} - def.value = props[key].anyOf.map((a) => mdReferenceFromRef(a.items.$ref)); - } - } else { - // "prop": {"anyOf": [{ "$ref": "..."}, { "$ref": "..."}]} - def.type = 'object'; - def.value = props[key].anyOf.map((a) => mdReferenceFromRef(a.$ref)); - } - } else if (props[key].enum) { - // "prop": {"type": "string", "enum": [...]} - def.value = props[key].enum.map((v) => `"${v}"`); - } - defs[key] = def; - }); - return defs; -} - -/** - * Mutate primary object properties to include secondary properties from a $ref - * - * If a property is only defined in the secondary properties, it is added to - * primary. For properties present in primary and secondary, attributes are - * treated as follows: - * - * property.type & property.value: primary is preferred, and secondary is used if - * not defined on primary. - * - * property.description: only primary is used. If description is not present on - * primary, it is blank. - * - * property.from: secondary is preferred - this means we get the parent where the - * property is originally defined. - */ -function spliceProperties(primary: Properties, secondary: Properties): void { - for (const prop in secondary) { - if (primary[prop]) { - primary[prop].type = primary[prop].type || secondary[prop].type; - primary[prop].value = primary[prop].value || secondary[prop].value; - primary[prop].from = secondary[prop].from || primary[prop].from; - } else { - primary[prop] = secondary[prop]; - } - } -} - -/** - * Extract property information from object definition - */ -function propsFromObject(schemaDefinitions: Schema, key: string, from?: string): PropertyInfo { - const properties: Properties = {}; - let required: string[] = []; - schemaDefinitions[key].allOf.forEach((subschema) => { - // By using simplifyForDocGeneration we ensure all objects have allOf key - if (subschema.required) { - required = required.concat(...subschema.required); - } - if (subschema.properties) { - // Properties defined directly on the object - spliceProperties(properties, definitionsFromProps(subschema.properties, from)); - } else if (subschema.$ref) { - // Properties defined on referenced definitions - const key = typeFromRef(subschema.$ref); - const refProps = propsFromObject(schemaDefinitions, key, key); - required = required.concat(...refProps.required); - spliceProperties(properties, refProps.properties); - } - }); - return { properties, required }; -} - -function schemaKey2md(schema: Schema, key: string): string { - let md = ''; - if (schema.$defs[key].description) { - md += `${schema.$defs[key].description.replace(/`/g, '\\`')}\n\n`; - } - if (schema.$defs[key].allOf) { - const { properties, required } = propsFromObject(schema.$defs, key); - for (const prop in properties) { - const { type, value, description, from } = properties[prop]; - const optionalDoc = required.includes(prop) ? '' : '_optional_'; - const propDoc = type ? `__${prop}__` : ''; - const typeDoc = type ? `_${type}_` : ''; - const descriptionDoc = description?.replace(/\n/g, '\n ') || undefined; - const referenceDoc = from ? `See also ${mdReferenceFromRef(from)}` : undefined; - const valueDoc = value - ? `(${typeof value === 'object' ? value.join(' | ') : `${value}`})` - : ''; - const afterProp = [typeDoc, optionalDoc, valueDoc].filter((d) => !!d).join(', '); - const backup = - !descriptionDoc && !referenceDoc ? 'No description for this property.' : undefined; - const definitionDetails = [descriptionDoc, referenceDoc, backup] - .filter((d) => d != null) - .join('\n: '); - md += `${propDoc}: ${afterProp}\n: ${definitionDetails}\n\n`; - } - } else if (schema.$defs[key].anyOf) { - if (schema.$defs[key].anyOf.length > 1) { - md += 'Any of '; - } else { - md += 'Only '; - } - md += schema.$defs[key].anyOf.map((a) => mdReferenceFromRef(a.$ref)).join(' | '); - md += '\n'; - } - return md; -} - -/** - * Convert myst-spec JSON schema file to markdown string - * - * Each object definition in $defs is written out as follows: - * - * # Name - * - * Object description - * - * - __property*__: _type_ ("value") Property description, astrisk - * indicates property is required - See [Parent]() - * - ... - */ -function schema2md(schema: Schema): string { - let md = '# Node Type Index\n\n'; - Object.keys(schema.$defs).forEach((key) => { - md += `(${key.toLowerCase()})=\n## ${key}\n\n`; - md += schemaKey2md(schema, key); - md += '\n'; - }); - return md; -} - -/** - * Generate files: - * - * - dist/myst.schema.json - JSON schema for MyST root and all dependent object - * types, consolidated into a single file - * - dist/index.d.ts - typescript types for all myst-schema objects - * - docs/myst.schema.md - markdown documentation of all myst-schema objects - * - docs/nodes/*.md - markdown schema snippets for each node type - * - dist/examples/*.yml - example files distributed for external testing - */ -async function generate(myst: Schema) { - if (!existsSync('dist')) mkdirSync('dist'); - if (!existsSync(join('dist', 'examples'))) mkdirSync(join('dist', 'examples')); - if (!existsSync('docs')) mkdirSync('docs'); - if (!existsSync(join('docs', 'nodes'))) mkdirSync(join('docs', 'nodes')); - let schema = flattenRefs(myst); - writeFileSync(join('dist', outputSchemaFile), JSON.stringify(schema, null, 2)); - simplifyForDocGeneration(schema); - writeFileSync(join('docs', outputDocFile), schema2md(schema)); - Object.keys(schema.$defs).forEach((key) => { - writeFileSync(join('docs', 'nodes', `${key.toLowerCase()}.md`), schemaKey2md(schema, key)); - }); - schema = flattenRefs(myst); - additionalPropsFalse(schema); - const generatedTypes = await compile(schema, 'Root'); - writeFileSync(join('dist', outputTsFile), generatedTypes); - // Rename the generated type from the $id-based name to Root - // json-schema-to-typescript generates a type based on $id, but we want it named Root - const rootTypeName = 'HttpsSpecMystToolsJsonSchemaMystSchemaJson'; - const currentContent = readFileSync(join('dist', outputTsFile), 'utf-8'); - // Replace all occurrences of the generated type name with Root - const renamedContent = currentContent.replace(new RegExp(rootTypeName, 'g'), 'Root'); - writeFileSync(join('dist', outputTsFile), renamedContent); - readdirSync(join('docs', 'examples')) - .filter((name) => name.endsWith('.yml')) - .forEach((name) => - copyFileSync(join('docs', 'examples', name), join('dist', 'examples', name)), - ); -} - -const myst = loadSchema(join(__dirname, 'schema', 'myst.schema.json')); -const subschemas = [ - 'blocks', - 'roles', - 'directives', - 'references', - 'abbreviations', - 'admonitions', - 'containers', - 'footnotes', - 'math', - 'tables', - 'styles', - 'comments', - 'commonmark', - 'unist', -]; -// Combine all schema files into the single myst schema document -subschemas.forEach( - (subschema) => - (myst.$defs = { - ...myst.$defs, - ...loadSchema(join(__dirname, 'schema', `${subschema}.schema.json`)).$defs, - }), -); -generate(myst); - -type TestFile = { - cases: TestCase[]; -}; -type TestCase = { - title: string; - id?: string; - description?: string; - skip?: boolean; - invalid?: boolean; - mdast: Record; - myst?: string; - html?: string; -}; - -type JsonTestCase = { - title: string; - mdast: Record; - myst: string; - html?: string; -}; - -const directory = join('docs', 'examples'); -const files: string[] = readdirSync(directory).filter((name) => name.endsWith('.yml')); -let jsonTestCases: JsonTestCase[] = []; -files.forEach((file) => { - const testYaml = readFileSync(join(directory, file)).toString(); - const cases = load(testYaml) as TestFile; - cases.cases.forEach((testCase) => { - if (!testCase.invalid && !testCase.skip && testCase.mdast && testCase.myst) { - let html = testCase.html; - if (html && !html.endsWith('\n')) { - html = html.concat('\n'); - } - jsonTestCases = jsonTestCases.concat({ - title: `${file.replace('.yml', '')}: ${testCase.title}`, - mdast: testCase.mdast, - myst: testCase.myst, - html, - }); - } - if (testCase.id) { - const outFile = join(directory, `${testCase.id}.md`); - let md = ''; - md += '``````{tab-set}\n'; - md += '`````{tab-item} Markup\n:sync: myst\n'; - if (testCase.myst) { - md += `\`\`\`\`\n${testCase.myst}\n\`\`\`\`\n`; - } else { - md += 'No MyST included in example.\n'; - } - md += '`````\n\n'; - md += '````{tab-item} AST\n:sync: ast\n'; - if (testCase.mdast) { - md += `\`\`\`yaml\n${dump(testCase.mdast)}\n\`\`\`\n`; - } else { - md += 'No AST included in example.\n'; - } - md += '````\n\n'; - md += '````{tab-item} Render\n:sync: render\n\n'; - if (testCase.myst) { - md += `${testCase.myst}\n\n`; - } else { - md += 'No renderer included in example.\n'; - } - md += '````\n\n'; - md += '``````\n\n'; - writeFileSync(outFile, md); - } - }); -}); -writeFileSync(join('dist', jsonTestCaseFile), JSON.stringify(jsonTestCases, null, 2)); diff --git a/packages/myst-spec/package.json b/packages/myst-spec/package.json index ed8f150a7..df56f46b4 100644 --- a/packages/myst-spec/package.json +++ b/packages/myst-spec/package.json @@ -24,17 +24,12 @@ }, "scripts": { "clean": "rimraf index.js dist", - "test": "bun test", - "test:watch": "bun test --watch", - "build": "npm run clean && tsc index.ts && node index.js" + "build": "npm run clean && tsc && copyfiles --up 1 \"docs/examples/*.yml\" dist" }, "bugs": { "url": "https://github.com/jupyter-book/myst-spec/issues" }, "devDependencies": { - "ajv": "^8.17.1", - "ajv-formats": "^3.0.1", - "js-yaml": "^4.1.0", - "json-schema-to-typescript": "^15.0.4" + "copyfiles": "^2.4.1" } } diff --git a/packages/myst-spec/schema/abbreviations.schema.json b/packages/myst-spec/schema/abbreviations.schema.json deleted file mode 100644 index 44b89bba3..000000000 --- a/packages/myst-spec/schema/abbreviations.schema.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/abbreviations.schema.json", - "description": "abbreviation node definition", - "$defs": { - "Abbreviation": { - "description": "Abbreviation node described by title", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "abbreviation" - }, - "children": { - "description": "abbreviated value", - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/StaticPhrasingContent" - } - }, - "title": { - "description": "advisory information for the abbreviation", - "type": "string" - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - } - } -} diff --git a/packages/myst-spec/schema/admonitions.schema.json b/packages/myst-spec/schema/admonitions.schema.json deleted file mode 100644 index 1107911ee..000000000 --- a/packages/myst-spec/schema/admonitions.schema.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/admonitions.schema.json", - "description": "admonition node for drawing attention to text, separate from the neighboring content", - "$defs": { - "Admonition": { - "description": "Admonition node for drawing attention to text, separate from the neighboring content", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "admonition" - }, - "kind": { - "description": "kind of admonition, to determine styling", - "type": "string", - "enum": [ - "attention", - "caution", - "danger", - "error", - "hint", - "important", - "note", - "seealso", - "tip", - "warning" - ] - }, - "class": { - "description": "admonition class info to override kind", - "type": "string" - }, - "children": { - "type": "array", - "items": { - "anyOf": [ - { "$ref": "#/$defs/AdmonitionTitle" }, - { "$ref": "myst.schema.json#/$defs/FlowContent" } - ] - }, - "description": "An optional `admonitionTitle` followed by the admonitions content." - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - }, - "AdmonitionTitle": { - "description": "Custom title for admonition, replaces kind as title", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "admonitionTitle" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/PhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - } - } -} diff --git a/packages/myst-spec/schema/blocks.schema.json b/packages/myst-spec/schema/blocks.schema.json deleted file mode 100644 index fd8fc62c0..000000000 --- a/packages/myst-spec/schema/blocks.schema.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/blocks.schema.json", - "description": "top-level myst block node types", - "$defs": { - "BlockBreak": { - "type": "object", - "description": "Top-level break in the myst document, breaking it into Blocks", - "allOf": [ - { - "properties": { - "type": { - "const": "blockBreak" - }, - "meta": { - "description": "Block metadata. Conventionally this is a stringified JSON dictionary but it may be any arbitrary string.", - "type": "string" - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - }, - "Block": { - "type": "object", - "description": "Top-level content blocks or cells the myst document, delimited by BlockBreaks", - "allOf": [ - { - "properties": { - "type": { - "const": "block" - }, - "meta": { - "description": "block metadata from preceding break; conventionally, a stringified JSON dictionary but may be any arbitrary string", - "type": "string" - }, - "children": { - "description": "Top-level children of myst document", - "anyOf": [ - { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/FlowContent" - } - }, - { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/ListContent" - } - }, - { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/PhrasingContent" - } - } - ] - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - } - } -} diff --git a/packages/myst-spec/schema/comments.schema.json b/packages/myst-spec/schema/comments.schema.json deleted file mode 100644 index e2fa0dc87..000000000 --- a/packages/myst-spec/schema/comments.schema.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/comments.schema.json", - "description": "comment nodes for comments present in myst but ignored upon render", - "$defs": { - "Comment": { - "description": "Comment nodes for comments present in myst but ignored upon render", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "mystComment" - }, - "value": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Literal" } - ] - } - } -} diff --git a/packages/myst-spec/schema/commonmark.schema.json b/packages/myst-spec/schema/commonmark.schema.json deleted file mode 100644 index cf07ad4b2..000000000 --- a/packages/myst-spec/schema/commonmark.schema.json +++ /dev/null @@ -1,593 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/commonmark.schema.json", - "description": "existing basic commonmark types for myst mdast - https://github.com/syntax-tree/mdast", - "$defs": { - "Paragraph": { - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "paragraph" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/PhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "Heading": { - "type": "object", - "allOf": [ - { - "required": ["depth"], - "properties": { - "type": { - "const": "heading" - }, - "depth": { - "type": "integer", - "minimum": 1, - "maximum": 6 - }, - "enumerated": { - "description": "count this heading for numbering based on kind, e.g. Section 2.4.1", - "type": "boolean" - }, - "enumerator": { - "description": "resolved enumerated value for this heading", - "type": "string" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/PhrasingContent" - } - }, - "identifier": {}, - "label": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" }, - { "$ref": "#/$defs/OptionalAssociation" } - ] - }, - "ThematicBreak": { - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "thematicBreak" - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - }, - "Blockquote": { - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "blockquote" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/FlowContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "List": { - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "list" - }, - "ordered": { - "description": "Is item order important or not?", - "type": "boolean" - }, - "start": { - "description": "Starting number of ordered list", - "type": "integer" - }, - "spread": { - "description": "One or more children are separated with a blank line from others", - "type": "boolean" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/ListContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "ListItem": { - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "listItem" - }, - "spread": { - "description": "One or more children are separated with a blank line from others", - "type": "boolean" - }, - "children": { - "type": "array", - "items": { - "anyOf": [ - { "$ref": "myst.schema.json#/$defs/PhrasingContent" }, - { "$ref": "myst.schema.json#/$defs/FlowContent" } - ] - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "HTML": { - "description": "Fragment of raw HTML - does not need to be valid or complete", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "html" - }, - "value": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Literal" } - ] - }, - "Code": { - "description": "Block of preformatted text", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "code" - }, - "lang": { - "description": "language of the code", - "type": "string" - }, - "meta": { - "description": "custom information relating to the node", - "type": "string" - }, - "class": { - "description": "user-defined class for code block", - "type": "string" - }, - "showLineNumbers": { - "type": "boolean" - }, - "startingLineNumber": { - "type": "integer", - "minimum": 1 - }, - "emphasizeLines": { - "type": "array", - "items": { - "type": "integer", - "minimum": 1 - } - }, - "identifier": {}, - "label": {}, - "value": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { - "if": { - "required": ["meta"] - }, - "then": { - "required": ["lang"] - }, - "else": {} - }, - { - "if": { - "required": ["startingLineNumber"] - }, - "then": { - "required": ["showLineNumbers"] - }, - "else": {} - }, - { "$ref": "#/$defs/OptionalAssociation" }, - { "$ref": "unist.schema.json#/$defs/Literal" } - ] - }, - "Definition": { - "description": "Reference to a url resource", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "definition" - }, - "identifier": {}, - "label": {}, - "url": {}, - "title": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "#/$defs/Association" }, - { "$ref": "#/$defs/Resource" }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - }, - "Text": { - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "text" - }, - "value": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Literal" } - ] - }, - "Emphasis": { - "description": "Stressed, italicized content", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "emphasis" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/PhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "EmphasisStatic": { - "description": "Stressed, italicized content, with static children; used when parent node requires static content", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "emphasis" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/StaticPhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "Strong": { - "description": "Important, serious, urgent, bold content", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "strong" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/PhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "StrongStatic": { - "description": "Important, serious, urgent, bold content, with static children; used when parent node requires static content", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "strong" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/StaticPhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "InlineCode": { - "description": "Fragment of code", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "inlineCode" - }, - "value": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Literal" } - ] - }, - "Break": { - "description": "Line break", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "break" - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - }, - "Link": { - "description": "Hyperlink", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "link" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/StaticPhrasingContent" - } - }, - "url": {}, - "title": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "#/$defs/Resource" }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "Image": { - "description": "Image hyperlink", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "image" - }, - "class": { - "description": "user-defined class for image", - "type": "string" - }, - "width": { - "description": "image width in pixels or percentage", - "type": "string" - }, - "align": { - "type": "string", - "enum": ["left", "center", "right"] - }, - "url": {}, - "title": {}, - "alt": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "#/$defs/Resource" }, - { "$ref": "#/$defs/Alternative" }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - }, - "LinkReference": { - "description": "Hyperlink through association", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "linkReference" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/StaticPhrasingContent" - } - }, - "referenceType": {}, - "identifier": {}, - "label": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "#/$defs/Reference" }, - { "$ref": "#/$defs/Association" }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "ImageReference": { - "description": "Image through association", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "imageReference" - }, - "referenceType": {}, - "identifier": {}, - "label": {}, - "alt": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "#/$defs/Reference" }, - { "$ref": "#/$defs/Association" }, - { "$ref": "#/$defs/Alternative" }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - }, - "Resource": { - "description": "Reference to external resource", - "type": "object", - "required": ["url"], - "properties": { - "url": { - "type": "string", - "description": "A Uniform Resource Locator (URL) to an external resource or link." - }, - "title": { - "description": "advisory information, e.g. for a tooltip", - "type": "string" - } - } - }, - "OptionalAssociation": { - "description": "Internal relation from one node to another; not required by node", - "type": "object", - "properties": { - "identifier": { - "description": "identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded", - "type": "string" - }, - "label": { - "description": "node label; character escapes and references are parsed; may be normalized to a unique identifier", - "type": "string" - } - } - }, - "Association": { - "description": "Internal relation from one node to another", - "type": "object", - "allOf": [ - { - "required": ["identifier"], - "properties": { "identifier": {} } - }, - { "$ref": "#/$defs/OptionalAssociation" } - ] - }, - "Alternative": { - "description": "Alternative description of image", - "type": "object", - "properties": { - "alt": { - "description": "field describing the image", - "type": "string" - } - } - }, - "Reference": { - "description": "Marker associated to another node", - "type": "object", - "required": ["referenceType"], - "properties": { - "referenceType": { - "description": "explicitness of the reference:\n`shortcut` - reference is implicit, identifier inferred\n`collapsed` - reference explicit, identifier inferred\n`full` - reference explicit, identifier explicit", - "type": "string", - "enum": ["shortcut", "collapsed", "full"] - } - } - } - } -} diff --git a/packages/myst-spec/schema/containers.schema.json b/packages/myst-spec/schema/containers.schema.json deleted file mode 100644 index 42455adbb..000000000 --- a/packages/myst-spec/schema/containers.schema.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/containers.schema.json", - "description": "container nodes for presenting images, tables, etc as cross-reference-able figures with caption and legend", - "$defs": { - "Container": { - "description": "Top-level container node to provide association and numbering to child content", - "type": "object", - "allOf": [ - { - "required": ["kind"], - "properties": { - "type": { - "const": "container" - }, - "kind": { - "description": "kind of container contents", - "type": "string", - "enum": ["figure", "table"] - }, - "class": { - "description": "any custom class information", - "type": "string" - }, - "enumerated": { - "description": "count this container for numbering based on kind, e.g. Figure 1a", - "type": "boolean" - }, - "enumerator": { - "description": "resolved enumerated value for this container", - "type": "string" - }, - "children": { - "type": "array", - "items": { - "anyOf": [ - { "$ref": "#/$defs/Caption" }, - { "$ref": "#/$defs/Legend" }, - { "$ref": "commonmark.schema.json#/$defs/Image" }, - { "$ref": "tables.schema.json#/$defs/Table" } - ] - } - }, - "identifier": {}, - "label": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { - "if": { - "properties": { - "kind": { - "const": "figure" - } - } - }, - "then": { - "properties": { - "children": { - "type": "array", - "items": { - "anyOf": [ - { "$ref": "#/$defs/Caption" }, - { "$ref": "#/$defs/Legend" }, - { "$ref": "commonmark.schema.json#/$defs/Image" } - ] - } - } - } - }, - "else": { - "properties": { - "children": { - "type": "array", - "items": { - "anyOf": [ - { "$ref": "#/$defs/Caption" }, - { "$ref": "#/$defs/Legend" }, - { "$ref": "tables.schema.json#/$defs/Table" } - ] - } - } - } - } - }, - { "$ref": "commonmark.schema.json#/$defs/OptionalAssociation" }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "Caption": { - "description": "Caption for container content", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "caption" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/FlowContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "Legend": { - "description": "Legend for container content", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "legend" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/FlowContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - } - } -} diff --git a/packages/myst-spec/schema/directives.schema.json b/packages/myst-spec/schema/directives.schema.json deleted file mode 100644 index e57d3ddde..000000000 --- a/packages/myst-spec/schema/directives.schema.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/directives.schema.json", - "description": "directive node - custom block behavior", - "$defs": { - "Directive": { - "description": "Content block with predefined behavior", - "type": "object", - "allOf": [ - { - "required": ["name"], - "properties": { - "type": { - "const": "mystDirective" - }, - "name": { - "type": "string" - }, - "args": { - "type": "string" - }, - "options": { - "type": "object" - }, - "value": { - "description": "body of the directive, excluding options", - "type": "string" - }, - "children": { - "description": "parsed directive content", - "type": "array", - "items": { - "anyOf": [ - { "$ref": "myst.schema.json#/$defs/FlowContent" }, - { "$ref": "myst.schema.json#/$defs/PhrasingContent" } - ] - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - } - } -} diff --git a/packages/myst-spec/schema/footnotes.schema.json b/packages/myst-spec/schema/footnotes.schema.json deleted file mode 100644 index 2eb5bd6cc..000000000 --- a/packages/myst-spec/schema/footnotes.schema.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/footnotes.schema.json", - "description": "footnote nodes", - "$defs": { - "FootnoteReference": { - "description": "Inline reference to footnote", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "footnoteReference" - }, - "identifier": {}, - "label": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "commonmark.schema.json#/$defs/Association" }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - }, - "FootnoteDefinition": { - "description": "Rich footnote content associated with footnote reference", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "footnoteDefinition" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/FlowContent" - } - }, - "identifier": {}, - "label": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "commonmark.schema.json#/$defs/Association" }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - } - } -} diff --git a/packages/myst-spec/schema/math.schema.json b/packages/myst-spec/schema/math.schema.json deleted file mode 100644 index 03d085553..000000000 --- a/packages/myst-spec/schema/math.schema.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/math.schema.json", - "description": "math node for presenting numbered equations", - "$defs": { - "Math": { - "description": "Math node for presenting numbered equations", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "math" - }, - "enumerated": { - "description": "count this math block for numbering based on kind, e.g. See equation (1a)", - "type": "boolean" - }, - "enumerator": { - "description": "resolved enumerated value for this math block", - "type": "string" - }, - "identifier": {}, - "label": {}, - "value": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "commonmark.schema.json#/$defs/OptionalAssociation" }, - { "$ref": "unist.schema.json#/$defs/Literal" } - ] - }, - "InlineMath": { - "description": "Fragment of math, similar to InlineCode, using role {math}", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "inlineMath" - }, - "value": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Literal" } - ] - } - } -} diff --git a/packages/myst-spec/schema/myst.schema.json b/packages/myst-spec/schema/myst.schema.json deleted file mode 100644 index dea72b086..000000000 --- a/packages/myst-spec/schema/myst.schema.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/myst.schema.json", - "description": "Myst syntax tree built on existing mdast schemas", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "root" - }, - "children": { - "description": "Top-level children of myst document", - "anyOf": [ - { - "type": "array", - "items": { - "anyOf": [ - { "$ref": "blocks.schema.json#/$defs/Block" }, - { "$ref": "blocks.schema.json#/$defs/BlockBreak" }, - { "$ref": "#/$defs/FlowContent" } - ] - } - }, - { - "type": "array", - "items": { - "$ref": "#/$defs/ListContent" - } - }, - { - "type": "array", - "items": { - "$ref": "#/$defs/PhrasingContent" - } - } - ] - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ], - "$defs": { - "FlowContent": { - "anyOf": [ - { "$ref": "commonmark.schema.json#/$defs/Paragraph" }, - { "$ref": "commonmark.schema.json#/$defs/Definition" }, - { "$ref": "commonmark.schema.json#/$defs/Heading" }, - { "$ref": "commonmark.schema.json#/$defs/ThematicBreak" }, - { "$ref": "commonmark.schema.json#/$defs/Blockquote" }, - { "$ref": "commonmark.schema.json#/$defs/List" }, - { "$ref": "commonmark.schema.json#/$defs/HTML" }, - { "$ref": "commonmark.schema.json#/$defs/Code" }, - { "$ref": "comments.schema.json#/$defs/Comment" }, - { "$ref": "references.schema.json#/$defs/Target" }, - { "$ref": "directives.schema.json#/$defs/Directive" }, - { "$ref": "admonitions.schema.json#/$defs/Admonition" }, - { "$ref": "containers.schema.json#/$defs/Container" }, - { "$ref": "math.schema.json#/$defs/Math" }, - { "$ref": "tables.schema.json#/$defs/Table" }, - { "$ref": "footnotes.schema.json#/$defs/FootnoteDefinition" } - ] - }, - "ListContent": { - "anyOf": [{ "$ref": "commonmark.schema.json#/$defs/ListItem" }] - }, - "PhrasingContent": { - "anyOf": [ - { "$ref": "#/$defs/StaticPhrasingContent" }, - { "$ref": "commonmark.schema.json#/$defs/Emphasis" }, - { "$ref": "commonmark.schema.json#/$defs/Strong" }, - { "$ref": "commonmark.schema.json#/$defs/Link" }, - { "$ref": "commonmark.schema.json#/$defs/LinkReference" }, - { "$ref": "styles.schema.json#/$defs/Subscript" }, - { "$ref": "styles.schema.json#/$defs/Superscript" }, - { "$ref": "styles.schema.json#/$defs/Underline" }, - { "$ref": "abbreviations.schema.json#/$defs/Abbreviation" }, - { "$ref": "references.schema.json#/$defs/CrossReference" }, - { "$ref": "footnotes.schema.json#/$defs/FootnoteReference" } - ] - }, - "StaticPhrasingContent": { - "anyOf": [ - { "$ref": "commonmark.schema.json#/$defs/Text" }, - { "$ref": "commonmark.schema.json#/$defs/HTML" }, - { "$ref": "commonmark.schema.json#/$defs/EmphasisStatic" }, - { "$ref": "commonmark.schema.json#/$defs/StrongStatic" }, - { "$ref": "commonmark.schema.json#/$defs/InlineCode" }, - { "$ref": "commonmark.schema.json#/$defs/Break" }, - { "$ref": "commonmark.schema.json#/$defs/Image" }, - { "$ref": "commonmark.schema.json#/$defs/ImageReference" }, - { "$ref": "roles.schema.json#/$defs/Role" }, - { "$ref": "styles.schema.json#/$defs/SubscriptStatic" }, - { "$ref": "styles.schema.json#/$defs/SuperscriptStatic" }, - { "$ref": "styles.schema.json#/$defs/UnderlineStatic" }, - { "$ref": "math.schema.json#/$defs/InlineMath" } - ] - } - } -} diff --git a/packages/myst-spec/schema/references.schema.json b/packages/myst-spec/schema/references.schema.json deleted file mode 100644 index bf0e52c22..000000000 --- a/packages/myst-spec/schema/references.schema.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/references.schema.json", - "description": "reference nodes", - "$defs": { - "Target": { - "description": "Target node - provides identifier/label for the following node", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "mystTarget" - }, - "label": { - "description": "unresolved target label", - "type": "string" - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - }, - "CrossReference": { - "description": "In-line reference to an associated node", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "crossReference" - }, - "kind": { - "type": "string", - "enum": ["eq", "numref", "ref"], - "description": "Indicates if the references should be numbered.\n```{warning}\nThe `kind` was based on docutils and is subject to change as we improve the `crossReference` experience.\n```" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/StaticPhrasingContent" - }, - "description": "Children of the crossReference, can include text with \"%s\" or \"{number}\" and enumerated references will be filled in." - }, - "identifier": {}, - "label": {}, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "commonmark.schema.json#/$defs/Association" }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - } - } -} diff --git a/packages/myst-spec/schema/roles.schema.json b/packages/myst-spec/schema/roles.schema.json deleted file mode 100644 index 345153706..000000000 --- a/packages/myst-spec/schema/roles.schema.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/roles.schema.json", - "description": "role node - custom in-line behavior", - "$defs": { - "Role": { - "description": "Custom in-line behavior", - "type": "object", - "allOf": [ - { - "required": ["name"], - "properties": { - "type": { - "const": "mystRole" - }, - "name": { - "type": "string" - }, - "value": { - "description": "content of the directive", - "type": "string" - }, - "children": { - "description": "parsed role content", - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/PhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Node" } - ] - } - } -} diff --git a/packages/myst-spec/schema/schema.spec.ts b/packages/myst-spec/schema/schema.spec.ts deleted file mode 100644 index 6add9f4f9..000000000 --- a/packages/myst-spec/schema/schema.spec.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { describe, expect, it, beforeEach, vi, test } from 'vitest'; - -import fs from 'fs'; -import path from 'path'; -import yaml from 'js-yaml'; -import Ajv from 'ajv'; -import addFormats from 'ajv-formats'; - -import myst from './myst.schema.json'; -import unist from './unist.schema.json'; -import abbreviations from './abbreviations.schema.json'; -import admonitions from './admonitions.schema.json'; -import blocks from './blocks.schema.json'; -import comments from './comments.schema.json'; -import commonmark from './commonmark.schema.json'; -import containers from './containers.schema.json'; -import directives from './directives.schema.json'; -import footnotes from './footnotes.schema.json'; -import math from './math.schema.json'; -import references from './references.schema.json'; -import roles from './roles.schema.json'; -import styles from './styles.schema.json'; -import tables from './tables.schema.json'; - -const ajv = new Ajv(); -addFormats(ajv); // allows {"format": "uri-reference"} -ajv.addSchema(myst); -ajv.addSchema(unist); -ajv.addSchema(abbreviations); -ajv.addSchema(admonitions); -ajv.addSchema(blocks); -ajv.addSchema(comments); -ajv.addSchema(commonmark); -ajv.addSchema(containers); -ajv.addSchema(directives); -ajv.addSchema(footnotes); -ajv.addSchema(math); -ajv.addSchema(references); -ajv.addSchema(roles); -ajv.addSchema(styles); -ajv.addSchema(tables); - -type TestFile = { - cases: TestCase[]; -}; -type TestCase = { - title: string; - description?: string; - skip?: boolean; - invalid?: boolean; - mdast: Record; - myst?: string; - html?: string; -}; - -const directory = path.join('docs', 'examples'); -const files: string[] = fs - .readdirSync(directory) - .filter((name) => name.endsWith('.yml')) - .map((name) => path.join(directory, name)); - -// For prettier printing of test cases -const length = files - .map((f) => path.basename(f).replace('.yml', '')) - .reduce((a, b) => Math.max(a, b.length), 0); - -const skipped: [string, TestCase][] = []; -const invalid: [string, TestCase][] = []; -const cases: [string, TestCase][] = files - .map((file) => { - const testYaml = fs.readFileSync(file).toString(); - const cases = yaml.load(testYaml) as TestFile; - return cases.cases.map((testCase) => { - const shortName = path.basename(file).replace('.yml', ''); - const section = `${shortName}:`.padEnd(length + 2, ' '); - const name = `${section} ${testCase.title}`; - return [name, testCase] as [string, TestCase]; - }); - }) - .flat() - .filter(([f, t]) => { - if (t.skip) skipped.push([f, t]); - if (t.invalid) invalid.push([f, t]); - return !t.skip && !t.invalid; - }); - -describe('Valid Schema Tests', () => { - test.each(cases)('%s', (_, { mdast }) => { - expect(ajv.validate(myst, mdast)).toBeTruthy(); - }); -}); - -if (invalid.length) { - describe('Invalid Schema Tests', () => { - test.each(invalid)('%s', (_, { mdast }) => { - expect(ajv.validate(myst, mdast)).toBeFalsy(); - }); - }); -} - -if (skipped.length) { - describe('Skipped Tests', () => { - test.skip.each(skipped)('%s', () => null); - }); -} diff --git a/packages/myst-spec/schema/styles.schema.json b/packages/myst-spec/schema/styles.schema.json deleted file mode 100644 index c4f586ded..000000000 --- a/packages/myst-spec/schema/styles.schema.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/styles.schema.json", - "description": "style nodes - similar to commonmark styles like emphasis/strong, but defined with a role", - "$defs": { - "Subscript": { - "description": "Subscript content, using role {subscript}", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "subscript" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/PhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "SubscriptStatic": { - "description": "Subscript content, with static children; used when parent node requires static content", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "subscript" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/StaticPhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "Superscript": { - "description": "Superscript content, using role {superscript}", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "superscript" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/PhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "SuperscriptStatic": { - "description": "Superscript content, with static children; used when parent node requires static content", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "superscript" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/StaticPhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "Underline": { - "description": "Underline content, using role {underline}", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "underline" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/PhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "UnderlineStatic": { - "description": "Underline content, with static children; used when parent node requires static content", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "underline" - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/StaticPhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - } - } -} diff --git a/packages/myst-spec/schema/tables.schema.json b/packages/myst-spec/schema/tables.schema.json deleted file mode 100644 index 88245a4de..000000000 --- a/packages/myst-spec/schema/tables.schema.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/tables.schema.json", - "description": "table nodes", - "$defs": { - "Table": { - "description": "Two-dimensional table data", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "table" - }, - "align": { - "type": "string", - "enum": ["left", "center", "right"] - }, - "children": { - "type": "array", - "items": { - "$ref": "#/$defs/TableRow" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "TableRow": { - "description": "One row of table containing cells", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "tableRow" - }, - "children": { - "type": "array", - "items": { - "$ref": "#/$defs/TableCell" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - }, - "TableCell": { - "description": "One cell of table", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "const": "tableCell" - }, - "header": { - "type": "boolean" - }, - "align": { - "description": "alignment of content within cell", - "type": "string", - "enum": ["left", "center", "right"] - }, - "children": { - "type": "array", - "items": { - "$ref": "myst.schema.json#/$defs/PhrasingContent" - } - }, - "position": {}, - "data": {} - }, - "additionalProperties": false - }, - { "$ref": "unist.schema.json#/$defs/Parent" } - ] - } - } -} diff --git a/packages/myst-spec/schema/unist.schema.json b/packages/myst-spec/schema/unist.schema.json deleted file mode 100644 index ab2730f52..000000000 --- a/packages/myst-spec/schema/unist.schema.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://spec.myst.tools/json-schema/unist.schema.json", - "description": "existing unist primitives for myst mdast - https://github.com/syntax-tree/unist", - "$defs": { - "Node": { - "description": "Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree.", - "type": "object", - "required": ["type"], - "properties": { - "type": { - "description": "identifier for node variant", - "type": "string" - }, - "data": { - "description": "information associated by the ecosystem with the node; never specified by mdast", - "type": "object" - }, - "position": { - "description": "location of node in source file; must not be present for generated nodes", - "$ref": "#/$defs/Position" - } - } - }, - "Literal": { - "description": "Basic node with required string value", - "type": "object", - "allOf": [ - { - "required": ["value"], - "properties": { - "value": { - "type": "string", - "description": "The value of the node" - } - } - }, - { "$ref": "#/$defs/Node" } - ] - }, - "Parent": { - "description": "Basic node with required node children", - "type": "object", - "allOf": [ - { - "required": ["children"], - "properties": { - "children": { - "type": "array", - "description": "List of children nodes", - "items": { - "$ref": "#/$defs/Node" - } - } - } - }, - { "$ref": "#/$defs/Node" } - ] - }, - "Point": { - "description": "One place in a source file", - "type": "object", - "required": ["line", "column"], - "properties": { - "line": { - "description": "line in the source file, 1-indexed", - "type": "integer", - "minimum": 1 - }, - "column": { - "description": "column in the source file, 1-indexed", - "type": "integer", - "minimum": 1 - }, - "offset": { - "description": "offset character in the source file, 0-indexed", - "type": "integer", - "minimum": 0 - } - }, - "additionalProperties": false - }, - "Position": { - "description": "Location of a node in a source file", - "type": "object", - "required": ["start", "end"], - "properties": { - "start": { - "description": "place of first character of parsed source region", - "$ref": "#/$defs/Point" - }, - "end": { - "description": "place of first character after parsed source region, whether it exists or not", - "$ref": "#/$defs/Point" - }, - "indent": { - "description": "start column at each index in the source region, for elements that span multiple lines", - "type": "array", - "items": { - "type": "integer", - "minimum": 0 - } - } - }, - "additionalProperties": false - } - } -} diff --git a/packages/myst-spec/src/index.ts b/packages/myst-spec/src/index.ts new file mode 100644 index 000000000..aac90a701 --- /dev/null +++ b/packages/myst-spec/src/index.ts @@ -0,0 +1,1430 @@ +/** + * Myst syntax tree built on existing mdast schemas + */ +export type Root = { + type?: 'root'; + /** + * Top-level children of myst document + */ + children?: (Block | BlockBreak | FlowContent)[] | ListContent[] | PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent26; +/** + * Top-level content blocks or cells the myst document, delimited by BlockBreaks + */ +export type Block = { + type?: 'block'; + /** + * block metadata from preceding break; conventionally, a stringified JSON dictionary but may be any arbitrary string + */ + meta?: string; + /** + * Top-level children of myst document + */ + children?: FlowContent[] | ListContent[] | PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Node14; +export type FlowContent = + | Paragraph + | Definition + | Heading + | ThematicBreak + | Blockquote + | List + | HTML + | Code + | Comment + | Target + | Directive + | Admonition + | Container + | Math + | Table + | FootnoteDefinition; +export type Paragraph = { + type?: 'paragraph'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent13; +export type PhrasingContent = + | StaticPhrasingContent + | Emphasis + | Strong + | Link + | LinkReference + | Subscript + | Superscript + | Underline + | Abbreviation + | CrossReference + | FootnoteReference; +export type StaticPhrasingContent = + | Text + | HTML + | EmphasisStatic + | StrongStatic + | InlineCode + | Break + | Image + | ImageReference + | Role + | SubscriptStatic + | SuperscriptStatic + | UnderlineStatic + | InlineMath; +export type Text = { + type?: 'text'; + value?: unknown; + position?: unknown; + data?: unknown; +} & Literal; +/** + * Basic node with required string value + */ +export type Literal = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Fragment of raw HTML - does not need to be valid or complete + */ +export type HTML = { + type?: 'html'; + value?: unknown; + position?: unknown; + data?: unknown; +} & Literal1; +/** + * Basic node with required string value + */ +export type Literal1 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Stressed, italicized content, with static children; used when parent node requires static content + */ +export type EmphasisStatic = { + type?: 'emphasis'; + children?: StaticPhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent; +/** + * Basic node with required node children + */ +export type Parent = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Important, serious, urgent, bold content, with static children; used when parent node requires static content + */ +export type StrongStatic = { + type?: 'strong'; + children?: StaticPhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent1; +/** + * Basic node with required node children + */ +export type Parent1 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Fragment of code + */ +export type InlineCode = { + type?: 'inlineCode'; + value?: unknown; + position?: unknown; + data?: unknown; +} & Literal2; +/** + * Basic node with required string value + */ +export type Literal2 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Line break + */ +export type Break = { + type?: 'break'; + position?: unknown; + data?: unknown; +} & Node3; +/** + * Image hyperlink + */ +export type Image = { + type?: 'image'; + /** + * user-defined class for image + */ + class?: string; + /** + * image width in pixels or percentage + */ + width?: string; + align?: 'left' | 'center' | 'right'; + url?: unknown; + title?: unknown; + alt?: unknown; + position?: unknown; + data?: unknown; +} & Resource & + Alternative & + Node4; +/** + * Image through association + */ +export type ImageReference = { + type?: 'imageReference'; + referenceType?: unknown; + identifier?: unknown; + label?: unknown; + alt?: unknown; + position?: unknown; + data?: unknown; +} & Reference & + Association & + Alternative1 & + Node5; +/** + * Internal relation from one node to another + */ +export type Association = { + identifier: unknown; +} & OptionalAssociation; +/** + * Custom in-line behavior + */ +export type Role = { + type?: 'mystRole'; + name: string; + /** + * content of the directive + */ + value?: string; + /** + * parsed role content + */ + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Node6; +/** + * Subscript content, with static children; used when parent node requires static content + */ +export type SubscriptStatic = { + type?: 'subscript'; + children?: StaticPhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent2; +/** + * Basic node with required node children + */ +export type Parent2 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Superscript content, with static children; used when parent node requires static content + */ +export type SuperscriptStatic = { + type?: 'superscript'; + children?: StaticPhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent3; +/** + * Basic node with required node children + */ +export type Parent3 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Underline content, with static children; used when parent node requires static content + */ +export type UnderlineStatic = { + type?: 'underline'; + children?: StaticPhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent4; +/** + * Basic node with required node children + */ +export type Parent4 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Fragment of math, similar to InlineCode, using role {math} + */ +export type InlineMath = { + type?: 'inlineMath'; + value?: unknown; + position?: unknown; + data?: unknown; +} & Literal3; +/** + * Basic node with required string value + */ +export type Literal3 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Stressed, italicized content + */ +export type Emphasis = { + type?: 'emphasis'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent5; +/** + * Basic node with required node children + */ +export type Parent5 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Important, serious, urgent, bold content + */ +export type Strong = { + type?: 'strong'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent6; +/** + * Basic node with required node children + */ +export type Parent6 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Hyperlink + */ +export type Link = { + type?: 'link'; + children?: StaticPhrasingContent[]; + url?: unknown; + title?: unknown; + position?: unknown; + data?: unknown; +} & Resource1 & + Parent7; +/** + * Basic node with required node children + */ +export type Parent7 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Hyperlink through association + */ +export type LinkReference = { + type?: 'linkReference'; + children?: StaticPhrasingContent[]; + referenceType?: unknown; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & Reference1 & + Association1 & + Parent8; +/** + * Internal relation from one node to another + */ +export type Association1 = { + identifier: unknown; +} & OptionalAssociation; +/** + * Basic node with required node children + */ +export type Parent8 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Subscript content, using role {subscript} + */ +export type Subscript = { + type?: 'subscript'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent9; +/** + * Basic node with required node children + */ +export type Parent9 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Superscript content, using role {superscript} + */ +export type Superscript = { + type?: 'superscript'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent10; +/** + * Basic node with required node children + */ +export type Parent10 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Underline content, using role {underline} + */ +export type Underline = { + type?: 'underline'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent11; +/** + * Basic node with required node children + */ +export type Parent11 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Abbreviation node described by title + */ +export type Abbreviation = { + type?: 'abbreviation'; + /** + * abbreviated value + */ + children?: StaticPhrasingContent[]; + /** + * advisory information for the abbreviation + */ + title?: string; + position?: unknown; + data?: unknown; +} & Parent12; +/** + * Basic node with required node children + */ +export type Parent12 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * In-line reference to an associated node + */ +export type CrossReference = { + type?: 'crossReference'; + /** + * Indicates if the references should be numbered. + * ```{warning} + * The `kind` was based on docutils and is subject to change as we improve the `crossReference` experience. + * ``` + */ + kind?: 'eq' | 'numref' | 'ref'; + /** + * Children of the crossReference, can include text with "%s" or "{number}" and enumerated references will be filled in. + */ + children?: StaticPhrasingContent[]; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & Association2 & + Node7; +/** + * Internal relation from one node to another + */ +export type Association2 = { + identifier: unknown; +} & OptionalAssociation; +/** + * Inline reference to footnote + */ +export type FootnoteReference = { + type?: 'footnoteReference'; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & Association3 & + Node8; +/** + * Internal relation from one node to another + */ +export type Association3 = { + identifier: unknown; +} & OptionalAssociation; +/** + * Basic node with required node children + */ +export type Parent13 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Reference to a url resource + */ +export type Definition = { + type?: 'definition'; + identifier?: unknown; + label?: unknown; + url?: unknown; + title?: unknown; + position?: unknown; + data?: unknown; +} & Association4 & + Resource2 & + Node9; +/** + * Internal relation from one node to another + */ +export type Association4 = { + identifier: unknown; +} & OptionalAssociation; +export type Heading = { + type?: 'heading'; + depth: number; + /** + * count this heading for numbering based on kind, e.g. Section 2.4.1 + */ + enumerated?: boolean; + /** + * resolved enumerated value for this heading + */ + enumerator?: string; + children?: PhrasingContent[]; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & Parent14 & + OptionalAssociation1; +/** + * Basic node with required node children + */ +export type Parent14 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +export type ThematicBreak = { + type?: 'thematicBreak'; + position?: unknown; + data?: unknown; +} & Node10; +export type Blockquote = { + type?: 'blockquote'; + children?: FlowContent[]; + position?: unknown; + data?: unknown; +} & Parent15; +/** + * Basic node with required node children + */ +export type Parent15 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +export type List = { + type?: 'list'; + /** + * Is item order important or not? + */ + ordered?: boolean; + /** + * Starting number of ordered list + */ + start?: number; + /** + * One or more children are separated with a blank line from others + */ + spread?: boolean; + children?: ListContent[]; + position?: unknown; + data?: unknown; +} & Parent17; +export type ListContent = ListItem; +export type ListItem = { + type?: 'listItem'; + /** + * One or more children are separated with a blank line from others + */ + spread?: boolean; + children?: (PhrasingContent | FlowContent)[]; + position?: unknown; + data?: unknown; +} & Parent16; +/** + * Basic node with required node children + */ +export type Parent16 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Basic node with required node children + */ +export type Parent17 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Block of preformatted text + */ +export type Code = { + type?: 'code'; + /** + * language of the code + */ + lang?: string; + /** + * custom information relating to the node + */ + meta?: string; + /** + * user-defined class for code block + */ + class?: string; + showLineNumbers?: boolean; + startingLineNumber?: number; + emphasizeLines?: number[]; + identifier?: unknown; + label?: unknown; + value?: unknown; + position?: unknown; + data?: unknown; +} & {} & OptionalAssociation2 & + Literal4; +/** + * Basic node with required string value + */ +export type Literal4 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Comment nodes for comments present in myst but ignored upon render + */ +export type Comment = { + type?: 'mystComment'; + value?: unknown; + position?: unknown; + data?: unknown; +} & Literal5; +/** + * Basic node with required string value + */ +export type Literal5 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Target node - provides identifier/label for the following node + */ +export type Target = { + type?: 'mystTarget'; + /** + * unresolved target label + */ + label?: string; + position?: unknown; + data?: unknown; +} & Node11; +/** + * Content block with predefined behavior + */ +export type Directive = { + type?: 'mystDirective'; + name: string; + args?: string; + options?: { + [k: string]: unknown; + }; + /** + * body of the directive, excluding options + */ + value?: string; + /** + * parsed directive content + */ + children?: (FlowContent | PhrasingContent)[]; + position?: unknown; + data?: unknown; +} & Node12; +/** + * Admonition node for drawing attention to text, separate from the neighboring content + */ +export type Admonition = { + type?: 'admonition'; + /** + * kind of admonition, to determine styling + */ + kind?: + | 'attention' + | 'caution' + | 'danger' + | 'error' + | 'hint' + | 'important' + | 'note' + | 'seealso' + | 'tip' + | 'warning'; + /** + * admonition class info to override kind + */ + class?: string; + /** + * An optional `admonitionTitle` followed by the admonitions content. + */ + children?: (AdmonitionTitle | FlowContent)[]; + position?: unknown; + data?: unknown; +} & Node13; +/** + * Custom title for admonition, replaces kind as title + */ +export type AdmonitionTitle = { + type?: 'admonitionTitle'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent18; +/** + * Basic node with required node children + */ +export type Parent18 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Top-level container node to provide association and numbering to child content + */ +export type Container = { + type?: 'container'; + /** + * kind of container contents + */ + kind: 'figure' | 'table'; + /** + * any custom class information + */ + class?: string; + /** + * count this container for numbering based on kind, e.g. Figure 1a + */ + enumerated?: boolean; + /** + * resolved enumerated value for this container + */ + enumerator?: string; + children?: (Caption | Legend | Image | Table)[]; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & {} & OptionalAssociation3 & + Parent24; +/** + * Caption for container content + */ +export type Caption = { + type?: 'caption'; + children?: FlowContent[]; + position?: unknown; + data?: unknown; +} & Parent19; +/** + * Basic node with required node children + */ +export type Parent19 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Legend for container content + */ +export type Legend = { + type?: 'legend'; + children?: FlowContent[]; + position?: unknown; + data?: unknown; +} & Parent20; +/** + * Basic node with required node children + */ +export type Parent20 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Two-dimensional table data + */ +export type Table = { + type?: 'table'; + align?: 'left' | 'center' | 'right'; + children?: TableRow[]; + position?: unknown; + data?: unknown; +} & Parent23; +/** + * One row of table containing cells + */ +export type TableRow = { + type?: 'tableRow'; + children?: TableCell[]; + position?: unknown; + data?: unknown; +} & Parent22; +/** + * One cell of table + */ +export type TableCell = { + type?: 'tableCell'; + header?: boolean; + /** + * alignment of content within cell + */ + align?: 'left' | 'center' | 'right'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent21; +/** + * Basic node with required node children + */ +export type Parent21 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Basic node with required node children + */ +export type Parent22 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Basic node with required node children + */ +export type Parent23 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Basic node with required node children + */ +export type Parent24 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Math node for presenting numbered equations + */ +export type Math = { + type?: 'math'; + /** + * count this math block for numbering based on kind, e.g. See equation (1a) + */ + enumerated?: boolean; + /** + * resolved enumerated value for this math block + */ + enumerator?: string; + identifier?: unknown; + label?: unknown; + value?: unknown; + position?: unknown; + data?: unknown; +} & OptionalAssociation4 & + Literal6; +/** + * Basic node with required string value + */ +export type Literal6 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Rich footnote content associated with footnote reference + */ +export type FootnoteDefinition = { + type?: 'footnoteDefinition'; + children?: FlowContent[]; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & Association5 & + Parent25; +/** + * Internal relation from one node to another + */ +export type Association5 = { + identifier: unknown; +} & OptionalAssociation; +/** + * Basic node with required node children + */ +export type Parent25 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Top-level break in the myst document, breaking it into Blocks + */ +export type BlockBreak = { + type?: 'blockBreak'; + /** + * Block metadata. Conventionally this is a stringified JSON dictionary but it may be any arbitrary string. + */ + meta?: string; + position?: unknown; + data?: unknown; +} & Node15; +/** + * Basic node with required node children + */ +export type Parent26 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; + +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * location of node in source file; must not be present for generated nodes + */ +export interface Position { + start: Point; + end: Point1; + /** + * start column at each index in the source region, for elements that span multiple lines + */ + indent?: number[]; +} +/** + * place of first character of parsed source region + */ +export interface Point { + /** + * line in the source file, 1-indexed + */ + line: number; + /** + * column in the source file, 1-indexed + */ + column: number; + /** + * offset character in the source file, 0-indexed + */ + offset?: number; +} +/** + * place of first character after parsed source region, whether it exists or not + */ +export interface Point1 { + /** + * line in the source file, 1-indexed + */ + line: number; + /** + * column in the source file, 1-indexed + */ + column: number; + /** + * offset character in the source file, 0-indexed + */ + offset?: number; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node1 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node2 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node3 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Reference to external resource + */ +export interface Resource { + /** + * A Uniform Resource Locator (URL) to an external resource or link. + */ + url: string; + /** + * advisory information, e.g. for a tooltip + */ + title?: string; +} +/** + * Alternative description of image + */ +export interface Alternative { + /** + * field describing the image + */ + alt?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node4 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Marker associated to another node + */ +export interface Reference { + /** + * explicitness of the reference: + * `shortcut` - reference is implicit, identifier inferred + * `collapsed` - reference explicit, identifier inferred + * `full` - reference explicit, identifier explicit + */ + referenceType: 'shortcut' | 'collapsed' | 'full'; +} +/** + * Internal relation from one node to another; not required by node + */ +export interface OptionalAssociation { + /** + * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + */ + identifier?: string; + /** + * node label; character escapes and references are parsed; may be normalized to a unique identifier + */ + label?: string; +} +/** + * Alternative description of image + */ +export interface Alternative1 { + /** + * field describing the image + */ + alt?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node5 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node6 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Reference to external resource + */ +export interface Resource1 { + /** + * A Uniform Resource Locator (URL) to an external resource or link. + */ + url: string; + /** + * advisory information, e.g. for a tooltip + */ + title?: string; +} +/** + * Marker associated to another node + */ +export interface Reference1 { + /** + * explicitness of the reference: + * `shortcut` - reference is implicit, identifier inferred + * `collapsed` - reference explicit, identifier inferred + * `full` - reference explicit, identifier explicit + */ + referenceType: 'shortcut' | 'collapsed' | 'full'; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node7 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node8 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Reference to external resource + */ +export interface Resource2 { + /** + * A Uniform Resource Locator (URL) to an external resource or link. + */ + url: string; + /** + * advisory information, e.g. for a tooltip + */ + title?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node9 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Internal relation from one node to another; not required by node + */ +export interface OptionalAssociation1 { + /** + * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + */ + identifier?: string; + /** + * node label; character escapes and references are parsed; may be normalized to a unique identifier + */ + label?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node10 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Internal relation from one node to another; not required by node + */ +export interface OptionalAssociation2 { + /** + * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + */ + identifier?: string; + /** + * node label; character escapes and references are parsed; may be normalized to a unique identifier + */ + label?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node11 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node12 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node13 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Internal relation from one node to another; not required by node + */ +export interface OptionalAssociation3 { + /** + * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + */ + identifier?: string; + /** + * node label; character escapes and references are parsed; may be normalized to a unique identifier + */ + label?: string; +} +/** + * Internal relation from one node to another; not required by node + */ +export interface OptionalAssociation4 { + /** + * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + */ + identifier?: string; + /** + * node label; character escapes and references are parsed; may be normalized to a unique identifier + */ + label?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node14 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node15 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} From b88d15df763d40e659b1166e86ab6ac6c2b6d7e6 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Thu, 11 Jun 2026 12:21:51 +0100 Subject: [PATCH 12/14] =?UTF-8?q?=E2=9A=9B=EF=B8=8F=20Fuse=20`myst-spec-ex?= =?UTF-8?q?t`=20into=20`myst-spec`=20(#2908)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/myst-spec-ext/src/index.ts | 152 +- .../src/types.ts => myst-spec/src/ext.ts} | 50 +- packages/myst-spec/src/index.ts | 1523 +---------------- packages/myst-spec/src/schema.ts | 1430 ++++++++++++++++ packages/myst-spec/src/search.ts | 48 + 5 files changed, 1723 insertions(+), 1480 deletions(-) rename packages/{myst-spec-ext/src/types.ts => myst-spec/src/ext.ts} (89%) create mode 100644 packages/myst-spec/src/schema.ts create mode 100644 packages/myst-spec/src/search.ts diff --git a/packages/myst-spec-ext/src/index.ts b/packages/myst-spec-ext/src/index.ts index d4702960d..8944680bf 100644 --- a/packages/myst-spec-ext/src/index.ts +++ b/packages/myst-spec-ext/src/index.ts @@ -1 +1,151 @@ -export * from './types.js'; +import type { + Admonition as SpecAdmonition, + AlgorithmLine as SpecAlgorithmLine, + AnyWidget as SpecAnyWidget, + Aside as SpecAside, + Block as SpecBlock, + CaptionNumber as SpecCaptionNumber, + Cite as SpecCite, + CiteGroup as SpecCiteGroup, + CiteKind as SpecCiteKind, + Code as SpecCode, + Container as SpecContainer, + CrossReference as SpecCrossReference, + DefinitionDescription as SpecDefinitionDescription, + DefinitionList as SpecDefinitionList, + DefinitionTerm as SpecDefinitionTerm, + Delete as SpecDelete, + Dependency as SpecDependency, + Embed as SpecEmbed, + FootnoteDefinition as SpecFootnoteDefinition, + FootnoteReference as SpecFootnoteReference, + Heading as SpecHeading, + Iframe as SpecIframe, + Image as SpecImage, + Include as SpecInclude, + IndexEntry as SpecIndexEntry, + InlineExpression as SpecInlineExpression, + InlineMath as SpecInlineMath, + Link as SpecLink, + ListItem as SpecListItem, + Math as SpecMath, + MathGroup as SpecMathGroup, + Output as SpecOutput, + Outputs as SpecOutputs, + Raw as SpecRaw, + SiUnit as SpecSiUnit, + Smallcaps as SpecSmallcaps, + TabItem as SpecTabItem, + TableCell as SpecTableCell, + TabSet as SpecTabSet, + Underline as SpecUnderline, + ContentRecord as SpecContentRecord, + DocumentHierarchy as SpecDocumentHierarchy, + HeadingRecord as SpecHeadingRecord, + MystSearchIndex as SpecMystSearchIndex, + SearchRecord as SpecSearchRecord, + SearchRecordBase as SpecSearchRecordBase, +} from 'myst-spec'; + +/** @deprecated Use `Admonition` from `myst-spec` instead */ +export type Admonition = SpecAdmonition; +/** @deprecated Use `AlgorithmLine` from `myst-spec` instead */ +export type AlgorithmLine = SpecAlgorithmLine; +/** @deprecated Use `AnyWidget` from `myst-spec` instead */ +export type AnyWidget = SpecAnyWidget; +/** @deprecated Use `Aside` from `myst-spec` instead */ +export type Aside = SpecAside; +/** @deprecated Use `Block` from `myst-spec` instead */ +export type Block = SpecBlock; +/** @deprecated Use `CaptionNumber` from `myst-spec` instead */ +export type CaptionNumber = SpecCaptionNumber; +/** @deprecated Use `Cite` from `myst-spec` instead */ +export type Cite = SpecCite; +/** @deprecated Use `CiteGroup` from `myst-spec` instead */ +export type CiteGroup = SpecCiteGroup; +/** @deprecated Use `CiteKind` from `myst-spec` instead */ +export type CiteKind = SpecCiteKind; +/** @deprecated Use `Code` from `myst-spec` instead */ +export type Code = SpecCode; +/** @deprecated Use `Container` from `myst-spec` instead */ +export type Container = SpecContainer; +/** @deprecated Use `CrossReference` from `myst-spec` instead */ +export type CrossReference = SpecCrossReference; +/** @deprecated Use `DefinitionDescription` from `myst-spec` instead */ +export type DefinitionDescription = SpecDefinitionDescription; +/** @deprecated Use `DefinitionList` from `myst-spec` instead */ +export type DefinitionList = SpecDefinitionList; +/** @deprecated Use `DefinitionTerm` from `myst-spec` instead */ +export type DefinitionTerm = SpecDefinitionTerm; +/** @deprecated Use `Delete` from `myst-spec` instead */ +export type Delete = SpecDelete; +/** @deprecated Use `Dependency` from `myst-spec` instead */ +export type Dependency = SpecDependency; +/** @deprecated Use `Embed` from `myst-spec` instead */ +export type Embed = SpecEmbed; +/** @deprecated Use `FootnoteDefinition` from `myst-spec` instead */ +export type FootnoteDefinition = SpecFootnoteDefinition; +/** @deprecated Use `FootnoteReference` from `myst-spec` instead */ +export type FootnoteReference = SpecFootnoteReference; +/** @deprecated Use `Heading` from `myst-spec` instead */ +export type Heading = SpecHeading; +/** @deprecated Use `Iframe` from `myst-spec` instead */ +export type Iframe = SpecIframe; +/** @deprecated Use `Image` from `myst-spec` instead */ +export type Image = SpecImage; +/** @deprecated Use `Include` from `myst-spec` instead */ +export type Include = SpecInclude; +/** @deprecated Use `IndexEntry` from `myst-spec` instead */ +export type IndexEntry = SpecIndexEntry; +/** @deprecated Use `InlineExpression` from `myst-spec` instead */ +export type InlineExpression = SpecInlineExpression; +/** @deprecated Use `InlineMath` from `myst-spec` instead */ +export type InlineMath = SpecInlineMath; +/** @deprecated Use `Link` from `myst-spec` instead */ +export type Link = SpecLink; +/** @deprecated Use `ListItem` from `myst-spec` instead */ +export type ListItem = SpecListItem; +/** @deprecated Use `Math` from `myst-spec` instead */ +export type Math = SpecMath; +/** @deprecated Use `MathGroup` from `myst-spec` instead */ +export type MathGroup = SpecMathGroup; +/** @deprecated Use `Output` from `myst-spec` instead */ +export type Output = SpecOutput; +/** @deprecated Use `Outputs` from `myst-spec` instead */ +export type Outputs = SpecOutputs; +/** @deprecated Use `Raw` from `myst-spec` instead */ +export type Raw = SpecRaw; +/** @deprecated Use `SiUnit` from `myst-spec` instead */ +export type SiUnit = SpecSiUnit; +/** @deprecated Use `Smallcaps` from `myst-spec` instead */ +export type Smallcaps = SpecSmallcaps; +/** @deprecated Use `TabItem` from `myst-spec` instead */ +export type TabItem = SpecTabItem; +/** @deprecated Use `TableCell` from `myst-spec` instead */ +export type TableCell = SpecTableCell; +/** @deprecated Use `TabSet` from `myst-spec` instead */ +export type TabSet = SpecTabSet; +/** @deprecated Use `Underline` from `myst-spec` instead */ +export type Underline = SpecUnderline; +/** @deprecated Use `ContentRecord` from `myst-spec` instead */ +export type ContentRecord = SpecContentRecord; +/** @deprecated Use `DocumentHierarchy` from `myst-spec` instead */ +export type DocumentHierarchy = SpecDocumentHierarchy; +/** @deprecated Use `HeadingRecord` from `myst-spec` instead */ +export type HeadingRecord = SpecHeadingRecord; +/** @deprecated Use `MystSearchIndex` from `myst-spec` instead */ +export type MystSearchIndex = SpecMystSearchIndex; +/** @deprecated Use `SearchRecord` from `myst-spec` instead */ +export type SearchRecord = SpecSearchRecord; +/** @deprecated Use `SearchRecordBase` from `myst-spec` instead */ +export type SearchRecordBase = SpecSearchRecordBase; +/** + * @deprecated Use the export from `myst-spec` + * + * This is a duplicate declaration, due to esbuild/bun problems + */ +export enum SourceFileKind { + Article = 'Article', + Notebook = 'Notebook', + Part = 'Part', +} diff --git a/packages/myst-spec-ext/src/types.ts b/packages/myst-spec/src/ext.ts similarity index 89% rename from packages/myst-spec-ext/src/types.ts rename to packages/myst-spec/src/ext.ts index 9c230c865..498b85f23 100644 --- a/packages/myst-spec-ext/src/types.ts +++ b/packages/myst-spec/src/ext.ts @@ -19,7 +19,7 @@ import type { Node, CrossReference as SpecCrossReference, Link as SpecLink, -} from 'myst-spec'; +} from './schema.d.ts'; type Visibility = 'show' | 'hide' | 'remove'; @@ -314,51 +314,3 @@ export type AnyWidget = { /** Tailwind classes to apply to the container element */ class?: string; }; -// Search types - -/** - * Hierarchy of headers in a document - */ -export type DocumentHierarchy = { - lvl1?: string; - lvl2?: string; - lvl3?: string; - lvl4?: string; - lvl5?: string; - lvl6?: string; -}; - -/** - * Base type for search records - */ -export type SearchRecordBase = { - hierarchy: DocumentHierarchy; - url: string; - - position: number; -}; - -/** - * Record pertaining to section headings - */ -export type HeadingRecord = SearchRecordBase & { - type: keyof DocumentHierarchy; -}; - -/** - * Record pertaining to section content - */ -export type ContentRecord = SearchRecordBase & { - type: 'content'; - content: string; -}; - -/** - * Indexed search record type - */ -export type SearchRecord = HeadingRecord | ContentRecord; - -export type MystSearchIndex = { - version: '1'; - records: SearchRecord[]; -}; diff --git a/packages/myst-spec/src/index.ts b/packages/myst-spec/src/index.ts index aac90a701..feb90f0e1 100644 --- a/packages/myst-spec/src/index.ts +++ b/packages/myst-spec/src/index.ts @@ -1,1430 +1,93 @@ -/** - * Myst syntax tree built on existing mdast schemas - */ -export type Root = { - type?: 'root'; - /** - * Top-level children of myst document - */ - children?: (Block | BlockBreak | FlowContent)[] | ListContent[] | PhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent26; -/** - * Top-level content blocks or cells the myst document, delimited by BlockBreaks - */ -export type Block = { - type?: 'block'; - /** - * block metadata from preceding break; conventionally, a stringified JSON dictionary but may be any arbitrary string - */ - meta?: string; - /** - * Top-level children of myst document - */ - children?: FlowContent[] | ListContent[] | PhrasingContent[]; - position?: unknown; - data?: unknown; -} & Node14; -export type FlowContent = - | Paragraph - | Definition - | Heading - | ThematicBreak - | Blockquote - | List - | HTML - | Code - | Comment - | Target - | Directive - | Admonition - | Container - | Math - | Table - | FootnoteDefinition; -export type Paragraph = { - type?: 'paragraph'; - children?: PhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent13; -export type PhrasingContent = - | StaticPhrasingContent - | Emphasis - | Strong - | Link - | LinkReference - | Subscript - | Superscript - | Underline - | Abbreviation - | CrossReference - | FootnoteReference; -export type StaticPhrasingContent = - | Text - | HTML - | EmphasisStatic - | StrongStatic - | InlineCode - | Break - | Image - | ImageReference - | Role - | SubscriptStatic - | SuperscriptStatic - | UnderlineStatic - | InlineMath; -export type Text = { - type?: 'text'; - value?: unknown; - position?: unknown; - data?: unknown; -} & Literal; -/** - * Basic node with required string value - */ -export type Literal = { - /** - * The value of the node - */ - value: string; -} & Node; -/** - * Fragment of raw HTML - does not need to be valid or complete - */ -export type HTML = { - type?: 'html'; - value?: unknown; - position?: unknown; - data?: unknown; -} & Literal1; -/** - * Basic node with required string value - */ -export type Literal1 = { - /** - * The value of the node - */ - value: string; -} & Node; -/** - * Stressed, italicized content, with static children; used when parent node requires static content - */ -export type EmphasisStatic = { - type?: 'emphasis'; - children?: StaticPhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent; -/** - * Basic node with required node children - */ -export type Parent = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Important, serious, urgent, bold content, with static children; used when parent node requires static content - */ -export type StrongStatic = { - type?: 'strong'; - children?: StaticPhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent1; -/** - * Basic node with required node children - */ -export type Parent1 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Fragment of code - */ -export type InlineCode = { - type?: 'inlineCode'; - value?: unknown; - position?: unknown; - data?: unknown; -} & Literal2; -/** - * Basic node with required string value - */ -export type Literal2 = { - /** - * The value of the node - */ - value: string; -} & Node; -/** - * Line break - */ -export type Break = { - type?: 'break'; - position?: unknown; - data?: unknown; -} & Node3; -/** - * Image hyperlink - */ -export type Image = { - type?: 'image'; - /** - * user-defined class for image - */ - class?: string; - /** - * image width in pixels or percentage - */ - width?: string; - align?: 'left' | 'center' | 'right'; - url?: unknown; - title?: unknown; - alt?: unknown; - position?: unknown; - data?: unknown; -} & Resource & - Alternative & - Node4; -/** - * Image through association - */ -export type ImageReference = { - type?: 'imageReference'; - referenceType?: unknown; - identifier?: unknown; - label?: unknown; - alt?: unknown; - position?: unknown; - data?: unknown; -} & Reference & - Association & - Alternative1 & - Node5; -/** - * Internal relation from one node to another - */ -export type Association = { - identifier: unknown; -} & OptionalAssociation; -/** - * Custom in-line behavior - */ -export type Role = { - type?: 'mystRole'; - name: string; - /** - * content of the directive - */ - value?: string; - /** - * parsed role content - */ - children?: PhrasingContent[]; - position?: unknown; - data?: unknown; -} & Node6; -/** - * Subscript content, with static children; used when parent node requires static content - */ -export type SubscriptStatic = { - type?: 'subscript'; - children?: StaticPhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent2; -/** - * Basic node with required node children - */ -export type Parent2 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Superscript content, with static children; used when parent node requires static content - */ -export type SuperscriptStatic = { - type?: 'superscript'; - children?: StaticPhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent3; -/** - * Basic node with required node children - */ -export type Parent3 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Underline content, with static children; used when parent node requires static content - */ -export type UnderlineStatic = { - type?: 'underline'; - children?: StaticPhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent4; -/** - * Basic node with required node children - */ -export type Parent4 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Fragment of math, similar to InlineCode, using role {math} - */ -export type InlineMath = { - type?: 'inlineMath'; - value?: unknown; - position?: unknown; - data?: unknown; -} & Literal3; -/** - * Basic node with required string value - */ -export type Literal3 = { - /** - * The value of the node - */ - value: string; -} & Node; -/** - * Stressed, italicized content - */ -export type Emphasis = { - type?: 'emphasis'; - children?: PhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent5; -/** - * Basic node with required node children - */ -export type Parent5 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Important, serious, urgent, bold content - */ -export type Strong = { - type?: 'strong'; - children?: PhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent6; -/** - * Basic node with required node children - */ -export type Parent6 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Hyperlink - */ -export type Link = { - type?: 'link'; - children?: StaticPhrasingContent[]; - url?: unknown; - title?: unknown; - position?: unknown; - data?: unknown; -} & Resource1 & - Parent7; -/** - * Basic node with required node children - */ -export type Parent7 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Hyperlink through association - */ -export type LinkReference = { - type?: 'linkReference'; - children?: StaticPhrasingContent[]; - referenceType?: unknown; - identifier?: unknown; - label?: unknown; - position?: unknown; - data?: unknown; -} & Reference1 & - Association1 & - Parent8; -/** - * Internal relation from one node to another - */ -export type Association1 = { - identifier: unknown; -} & OptionalAssociation; -/** - * Basic node with required node children - */ -export type Parent8 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Subscript content, using role {subscript} - */ -export type Subscript = { - type?: 'subscript'; - children?: PhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent9; -/** - * Basic node with required node children - */ -export type Parent9 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Superscript content, using role {superscript} - */ -export type Superscript = { - type?: 'superscript'; - children?: PhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent10; -/** - * Basic node with required node children - */ -export type Parent10 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Underline content, using role {underline} - */ -export type Underline = { - type?: 'underline'; - children?: PhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent11; -/** - * Basic node with required node children - */ -export type Parent11 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Abbreviation node described by title - */ -export type Abbreviation = { - type?: 'abbreviation'; - /** - * abbreviated value - */ - children?: StaticPhrasingContent[]; - /** - * advisory information for the abbreviation - */ - title?: string; - position?: unknown; - data?: unknown; -} & Parent12; -/** - * Basic node with required node children - */ -export type Parent12 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * In-line reference to an associated node - */ -export type CrossReference = { - type?: 'crossReference'; - /** - * Indicates if the references should be numbered. - * ```{warning} - * The `kind` was based on docutils and is subject to change as we improve the `crossReference` experience. - * ``` - */ - kind?: 'eq' | 'numref' | 'ref'; - /** - * Children of the crossReference, can include text with "%s" or "{number}" and enumerated references will be filled in. - */ - children?: StaticPhrasingContent[]; - identifier?: unknown; - label?: unknown; - position?: unknown; - data?: unknown; -} & Association2 & - Node7; -/** - * Internal relation from one node to another - */ -export type Association2 = { - identifier: unknown; -} & OptionalAssociation; -/** - * Inline reference to footnote - */ -export type FootnoteReference = { - type?: 'footnoteReference'; - identifier?: unknown; - label?: unknown; - position?: unknown; - data?: unknown; -} & Association3 & - Node8; -/** - * Internal relation from one node to another - */ -export type Association3 = { - identifier: unknown; -} & OptionalAssociation; -/** - * Basic node with required node children - */ -export type Parent13 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Reference to a url resource - */ -export type Definition = { - type?: 'definition'; - identifier?: unknown; - label?: unknown; - url?: unknown; - title?: unknown; - position?: unknown; - data?: unknown; -} & Association4 & - Resource2 & - Node9; -/** - * Internal relation from one node to another - */ -export type Association4 = { - identifier: unknown; -} & OptionalAssociation; -export type Heading = { - type?: 'heading'; - depth: number; - /** - * count this heading for numbering based on kind, e.g. Section 2.4.1 - */ - enumerated?: boolean; - /** - * resolved enumerated value for this heading - */ - enumerator?: string; - children?: PhrasingContent[]; - identifier?: unknown; - label?: unknown; - position?: unknown; - data?: unknown; -} & Parent14 & - OptionalAssociation1; -/** - * Basic node with required node children - */ -export type Parent14 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -export type ThematicBreak = { - type?: 'thematicBreak'; - position?: unknown; - data?: unknown; -} & Node10; -export type Blockquote = { - type?: 'blockquote'; - children?: FlowContent[]; - position?: unknown; - data?: unknown; -} & Parent15; -/** - * Basic node with required node children - */ -export type Parent15 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -export type List = { - type?: 'list'; - /** - * Is item order important or not? - */ - ordered?: boolean; - /** - * Starting number of ordered list - */ - start?: number; - /** - * One or more children are separated with a blank line from others - */ - spread?: boolean; - children?: ListContent[]; - position?: unknown; - data?: unknown; -} & Parent17; -export type ListContent = ListItem; -export type ListItem = { - type?: 'listItem'; - /** - * One or more children are separated with a blank line from others - */ - spread?: boolean; - children?: (PhrasingContent | FlowContent)[]; - position?: unknown; - data?: unknown; -} & Parent16; -/** - * Basic node with required node children - */ -export type Parent16 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Basic node with required node children - */ -export type Parent17 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Block of preformatted text - */ -export type Code = { - type?: 'code'; - /** - * language of the code - */ - lang?: string; - /** - * custom information relating to the node - */ - meta?: string; - /** - * user-defined class for code block - */ - class?: string; - showLineNumbers?: boolean; - startingLineNumber?: number; - emphasizeLines?: number[]; - identifier?: unknown; - label?: unknown; - value?: unknown; - position?: unknown; - data?: unknown; -} & {} & OptionalAssociation2 & - Literal4; -/** - * Basic node with required string value - */ -export type Literal4 = { - /** - * The value of the node - */ - value: string; -} & Node; -/** - * Comment nodes for comments present in myst but ignored upon render - */ -export type Comment = { - type?: 'mystComment'; - value?: unknown; - position?: unknown; - data?: unknown; -} & Literal5; -/** - * Basic node with required string value - */ -export type Literal5 = { - /** - * The value of the node - */ - value: string; -} & Node; -/** - * Target node - provides identifier/label for the following node - */ -export type Target = { - type?: 'mystTarget'; - /** - * unresolved target label - */ - label?: string; - position?: unknown; - data?: unknown; -} & Node11; -/** - * Content block with predefined behavior - */ -export type Directive = { - type?: 'mystDirective'; - name: string; - args?: string; - options?: { - [k: string]: unknown; - }; - /** - * body of the directive, excluding options - */ - value?: string; - /** - * parsed directive content - */ - children?: (FlowContent | PhrasingContent)[]; - position?: unknown; - data?: unknown; -} & Node12; -/** - * Admonition node for drawing attention to text, separate from the neighboring content - */ -export type Admonition = { - type?: 'admonition'; - /** - * kind of admonition, to determine styling - */ - kind?: - | 'attention' - | 'caution' - | 'danger' - | 'error' - | 'hint' - | 'important' - | 'note' - | 'seealso' - | 'tip' - | 'warning'; - /** - * admonition class info to override kind - */ - class?: string; - /** - * An optional `admonitionTitle` followed by the admonitions content. - */ - children?: (AdmonitionTitle | FlowContent)[]; - position?: unknown; - data?: unknown; -} & Node13; -/** - * Custom title for admonition, replaces kind as title - */ -export type AdmonitionTitle = { - type?: 'admonitionTitle'; - children?: PhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent18; -/** - * Basic node with required node children - */ -export type Parent18 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Top-level container node to provide association and numbering to child content - */ -export type Container = { - type?: 'container'; - /** - * kind of container contents - */ - kind: 'figure' | 'table'; - /** - * any custom class information - */ - class?: string; - /** - * count this container for numbering based on kind, e.g. Figure 1a - */ - enumerated?: boolean; - /** - * resolved enumerated value for this container - */ - enumerator?: string; - children?: (Caption | Legend | Image | Table)[]; - identifier?: unknown; - label?: unknown; - position?: unknown; - data?: unknown; -} & {} & OptionalAssociation3 & - Parent24; -/** - * Caption for container content - */ -export type Caption = { - type?: 'caption'; - children?: FlowContent[]; - position?: unknown; - data?: unknown; -} & Parent19; -/** - * Basic node with required node children - */ -export type Parent19 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Legend for container content - */ -export type Legend = { - type?: 'legend'; - children?: FlowContent[]; - position?: unknown; - data?: unknown; -} & Parent20; -/** - * Basic node with required node children - */ -export type Parent20 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Two-dimensional table data - */ -export type Table = { - type?: 'table'; - align?: 'left' | 'center' | 'right'; - children?: TableRow[]; - position?: unknown; - data?: unknown; -} & Parent23; -/** - * One row of table containing cells - */ -export type TableRow = { - type?: 'tableRow'; - children?: TableCell[]; - position?: unknown; - data?: unknown; -} & Parent22; -/** - * One cell of table - */ -export type TableCell = { - type?: 'tableCell'; - header?: boolean; - /** - * alignment of content within cell - */ - align?: 'left' | 'center' | 'right'; - children?: PhrasingContent[]; - position?: unknown; - data?: unknown; -} & Parent21; -/** - * Basic node with required node children - */ -export type Parent21 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Basic node with required node children - */ -export type Parent22 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Basic node with required node children - */ -export type Parent23 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Basic node with required node children - */ -export type Parent24 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Math node for presenting numbered equations - */ -export type Math = { - type?: 'math'; - /** - * count this math block for numbering based on kind, e.g. See equation (1a) - */ - enumerated?: boolean; - /** - * resolved enumerated value for this math block - */ - enumerator?: string; - identifier?: unknown; - label?: unknown; - value?: unknown; - position?: unknown; - data?: unknown; -} & OptionalAssociation4 & - Literal6; -/** - * Basic node with required string value - */ -export type Literal6 = { - /** - * The value of the node - */ - value: string; -} & Node; -/** - * Rich footnote content associated with footnote reference - */ -export type FootnoteDefinition = { - type?: 'footnoteDefinition'; - children?: FlowContent[]; - identifier?: unknown; - label?: unknown; - position?: unknown; - data?: unknown; -} & Association5 & - Parent25; -/** - * Internal relation from one node to another - */ -export type Association5 = { - identifier: unknown; -} & OptionalAssociation; -/** - * Basic node with required node children - */ -export type Parent25 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; -/** - * Top-level break in the myst document, breaking it into Blocks - */ -export type BlockBreak = { - type?: 'blockBreak'; - /** - * Block metadata. Conventionally this is a stringified JSON dictionary but it may be any arbitrary string. - */ - meta?: string; - position?: unknown; - data?: unknown; -} & Node15; -/** - * Basic node with required node children - */ -export type Parent26 = { - /** - * List of children nodes - */ - children: Node1[]; -} & Node2; - -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * location of node in source file; must not be present for generated nodes - */ -export interface Position { - start: Point; - end: Point1; - /** - * start column at each index in the source region, for elements that span multiple lines - */ - indent?: number[]; -} -/** - * place of first character of parsed source region - */ -export interface Point { - /** - * line in the source file, 1-indexed - */ - line: number; - /** - * column in the source file, 1-indexed - */ - column: number; - /** - * offset character in the source file, 0-indexed - */ - offset?: number; -} -/** - * place of first character after parsed source region, whether it exists or not - */ -export interface Point1 { - /** - * line in the source file, 1-indexed - */ - line: number; - /** - * column in the source file, 1-indexed - */ - column: number; - /** - * offset character in the source file, 0-indexed - */ - offset?: number; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node1 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node2 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node3 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Reference to external resource - */ -export interface Resource { - /** - * A Uniform Resource Locator (URL) to an external resource or link. - */ - url: string; - /** - * advisory information, e.g. for a tooltip - */ - title?: string; -} -/** - * Alternative description of image - */ -export interface Alternative { - /** - * field describing the image - */ - alt?: string; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node4 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Marker associated to another node - */ -export interface Reference { - /** - * explicitness of the reference: - * `shortcut` - reference is implicit, identifier inferred - * `collapsed` - reference explicit, identifier inferred - * `full` - reference explicit, identifier explicit - */ - referenceType: 'shortcut' | 'collapsed' | 'full'; -} -/** - * Internal relation from one node to another; not required by node - */ -export interface OptionalAssociation { - /** - * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded - */ - identifier?: string; - /** - * node label; character escapes and references are parsed; may be normalized to a unique identifier - */ - label?: string; -} -/** - * Alternative description of image - */ -export interface Alternative1 { - /** - * field describing the image - */ - alt?: string; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node5 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node6 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Reference to external resource - */ -export interface Resource1 { - /** - * A Uniform Resource Locator (URL) to an external resource or link. - */ - url: string; - /** - * advisory information, e.g. for a tooltip - */ - title?: string; -} -/** - * Marker associated to another node - */ -export interface Reference1 { - /** - * explicitness of the reference: - * `shortcut` - reference is implicit, identifier inferred - * `collapsed` - reference explicit, identifier inferred - * `full` - reference explicit, identifier explicit - */ - referenceType: 'shortcut' | 'collapsed' | 'full'; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node7 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node8 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Reference to external resource - */ -export interface Resource2 { - /** - * A Uniform Resource Locator (URL) to an external resource or link. - */ - url: string; - /** - * advisory information, e.g. for a tooltip - */ - title?: string; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node9 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Internal relation from one node to another; not required by node - */ -export interface OptionalAssociation1 { - /** - * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded - */ - identifier?: string; - /** - * node label; character escapes and references are parsed; may be normalized to a unique identifier - */ - label?: string; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node10 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Internal relation from one node to another; not required by node - */ -export interface OptionalAssociation2 { - /** - * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded - */ - identifier?: string; - /** - * node label; character escapes and references are parsed; may be normalized to a unique identifier - */ - label?: string; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node11 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node12 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node13 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Internal relation from one node to another; not required by node - */ -export interface OptionalAssociation3 { - /** - * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded - */ - identifier?: string; - /** - * node label; character escapes and references are parsed; may be normalized to a unique identifier - */ - label?: string; -} -/** - * Internal relation from one node to another; not required by node - */ -export interface OptionalAssociation4 { - /** - * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded - */ - identifier?: string; - /** - * node label; character escapes and references are parsed; may be normalized to a unique identifier - */ - label?: string; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node14 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} -/** - * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. - */ -export interface Node15 { - /** - * identifier for node variant - */ - type: string; - /** - * information associated by the ecosystem with the node; never specified by mdast - */ - data?: { - [k: string]: unknown; - }; - position?: Position; -} +export type * from './search.ts'; +// Types that are not exported by nodes +export type { + Abbreviation, + AdmonitionTitle, + Alternative, + Association, + BlockBreak, + Blockquote, + Break, + Caption, + Comment, + Definition, + Directive, + Emphasis, + EmphasisStatic, + FlowContent, + HTML, + ImageReference, + InlineCode, + Legend, + LinkReference, + List, + ListContent, + Literal, + Node, + OptionalAssociation, + Paragraph, + Parent, + PhrasingContent, + Point, + Position, + Reference, + Resource, + Role, + Root, + StaticPhrasingContent, + Strong, + StrongStatic, + Subscript, + SubscriptStatic, + Superscript, + SuperscriptStatic, + Table, + TableRow, + Target, + Text, + ThematicBreak, + UnderlineStatic, +} from './schema.d.ts'; +export type { + Admonition, + AlgorithmLine, + AnyWidget, + Aside, + Block, + CaptionNumber, + Cite, + CiteGroup, + CiteKind, + Code, + Container, + CrossReference, + DefinitionDescription, + DefinitionList, + DefinitionTerm, + Delete, + Dependency, + Embed, + FootnoteDefinition, + FootnoteReference, + Heading, + Iframe, + Image, + Include, + IndexEntry, + InlineExpression, + InlineMath, + Link, + ListItem, + Math, + MathGroup, + Output, + Outputs, + Raw, + SiUnit, + Smallcaps, + TabItem, + TableCell, + TabSet, + Underline, +} from './ext.ts'; +export { SourceFileKind } from './ext.js'; diff --git a/packages/myst-spec/src/schema.ts b/packages/myst-spec/src/schema.ts new file mode 100644 index 000000000..aac90a701 --- /dev/null +++ b/packages/myst-spec/src/schema.ts @@ -0,0 +1,1430 @@ +/** + * Myst syntax tree built on existing mdast schemas + */ +export type Root = { + type?: 'root'; + /** + * Top-level children of myst document + */ + children?: (Block | BlockBreak | FlowContent)[] | ListContent[] | PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent26; +/** + * Top-level content blocks or cells the myst document, delimited by BlockBreaks + */ +export type Block = { + type?: 'block'; + /** + * block metadata from preceding break; conventionally, a stringified JSON dictionary but may be any arbitrary string + */ + meta?: string; + /** + * Top-level children of myst document + */ + children?: FlowContent[] | ListContent[] | PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Node14; +export type FlowContent = + | Paragraph + | Definition + | Heading + | ThematicBreak + | Blockquote + | List + | HTML + | Code + | Comment + | Target + | Directive + | Admonition + | Container + | Math + | Table + | FootnoteDefinition; +export type Paragraph = { + type?: 'paragraph'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent13; +export type PhrasingContent = + | StaticPhrasingContent + | Emphasis + | Strong + | Link + | LinkReference + | Subscript + | Superscript + | Underline + | Abbreviation + | CrossReference + | FootnoteReference; +export type StaticPhrasingContent = + | Text + | HTML + | EmphasisStatic + | StrongStatic + | InlineCode + | Break + | Image + | ImageReference + | Role + | SubscriptStatic + | SuperscriptStatic + | UnderlineStatic + | InlineMath; +export type Text = { + type?: 'text'; + value?: unknown; + position?: unknown; + data?: unknown; +} & Literal; +/** + * Basic node with required string value + */ +export type Literal = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Fragment of raw HTML - does not need to be valid or complete + */ +export type HTML = { + type?: 'html'; + value?: unknown; + position?: unknown; + data?: unknown; +} & Literal1; +/** + * Basic node with required string value + */ +export type Literal1 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Stressed, italicized content, with static children; used when parent node requires static content + */ +export type EmphasisStatic = { + type?: 'emphasis'; + children?: StaticPhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent; +/** + * Basic node with required node children + */ +export type Parent = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Important, serious, urgent, bold content, with static children; used when parent node requires static content + */ +export type StrongStatic = { + type?: 'strong'; + children?: StaticPhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent1; +/** + * Basic node with required node children + */ +export type Parent1 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Fragment of code + */ +export type InlineCode = { + type?: 'inlineCode'; + value?: unknown; + position?: unknown; + data?: unknown; +} & Literal2; +/** + * Basic node with required string value + */ +export type Literal2 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Line break + */ +export type Break = { + type?: 'break'; + position?: unknown; + data?: unknown; +} & Node3; +/** + * Image hyperlink + */ +export type Image = { + type?: 'image'; + /** + * user-defined class for image + */ + class?: string; + /** + * image width in pixels or percentage + */ + width?: string; + align?: 'left' | 'center' | 'right'; + url?: unknown; + title?: unknown; + alt?: unknown; + position?: unknown; + data?: unknown; +} & Resource & + Alternative & + Node4; +/** + * Image through association + */ +export type ImageReference = { + type?: 'imageReference'; + referenceType?: unknown; + identifier?: unknown; + label?: unknown; + alt?: unknown; + position?: unknown; + data?: unknown; +} & Reference & + Association & + Alternative1 & + Node5; +/** + * Internal relation from one node to another + */ +export type Association = { + identifier: unknown; +} & OptionalAssociation; +/** + * Custom in-line behavior + */ +export type Role = { + type?: 'mystRole'; + name: string; + /** + * content of the directive + */ + value?: string; + /** + * parsed role content + */ + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Node6; +/** + * Subscript content, with static children; used when parent node requires static content + */ +export type SubscriptStatic = { + type?: 'subscript'; + children?: StaticPhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent2; +/** + * Basic node with required node children + */ +export type Parent2 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Superscript content, with static children; used when parent node requires static content + */ +export type SuperscriptStatic = { + type?: 'superscript'; + children?: StaticPhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent3; +/** + * Basic node with required node children + */ +export type Parent3 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Underline content, with static children; used when parent node requires static content + */ +export type UnderlineStatic = { + type?: 'underline'; + children?: StaticPhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent4; +/** + * Basic node with required node children + */ +export type Parent4 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Fragment of math, similar to InlineCode, using role {math} + */ +export type InlineMath = { + type?: 'inlineMath'; + value?: unknown; + position?: unknown; + data?: unknown; +} & Literal3; +/** + * Basic node with required string value + */ +export type Literal3 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Stressed, italicized content + */ +export type Emphasis = { + type?: 'emphasis'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent5; +/** + * Basic node with required node children + */ +export type Parent5 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Important, serious, urgent, bold content + */ +export type Strong = { + type?: 'strong'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent6; +/** + * Basic node with required node children + */ +export type Parent6 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Hyperlink + */ +export type Link = { + type?: 'link'; + children?: StaticPhrasingContent[]; + url?: unknown; + title?: unknown; + position?: unknown; + data?: unknown; +} & Resource1 & + Parent7; +/** + * Basic node with required node children + */ +export type Parent7 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Hyperlink through association + */ +export type LinkReference = { + type?: 'linkReference'; + children?: StaticPhrasingContent[]; + referenceType?: unknown; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & Reference1 & + Association1 & + Parent8; +/** + * Internal relation from one node to another + */ +export type Association1 = { + identifier: unknown; +} & OptionalAssociation; +/** + * Basic node with required node children + */ +export type Parent8 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Subscript content, using role {subscript} + */ +export type Subscript = { + type?: 'subscript'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent9; +/** + * Basic node with required node children + */ +export type Parent9 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Superscript content, using role {superscript} + */ +export type Superscript = { + type?: 'superscript'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent10; +/** + * Basic node with required node children + */ +export type Parent10 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Underline content, using role {underline} + */ +export type Underline = { + type?: 'underline'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent11; +/** + * Basic node with required node children + */ +export type Parent11 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Abbreviation node described by title + */ +export type Abbreviation = { + type?: 'abbreviation'; + /** + * abbreviated value + */ + children?: StaticPhrasingContent[]; + /** + * advisory information for the abbreviation + */ + title?: string; + position?: unknown; + data?: unknown; +} & Parent12; +/** + * Basic node with required node children + */ +export type Parent12 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * In-line reference to an associated node + */ +export type CrossReference = { + type?: 'crossReference'; + /** + * Indicates if the references should be numbered. + * ```{warning} + * The `kind` was based on docutils and is subject to change as we improve the `crossReference` experience. + * ``` + */ + kind?: 'eq' | 'numref' | 'ref'; + /** + * Children of the crossReference, can include text with "%s" or "{number}" and enumerated references will be filled in. + */ + children?: StaticPhrasingContent[]; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & Association2 & + Node7; +/** + * Internal relation from one node to another + */ +export type Association2 = { + identifier: unknown; +} & OptionalAssociation; +/** + * Inline reference to footnote + */ +export type FootnoteReference = { + type?: 'footnoteReference'; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & Association3 & + Node8; +/** + * Internal relation from one node to another + */ +export type Association3 = { + identifier: unknown; +} & OptionalAssociation; +/** + * Basic node with required node children + */ +export type Parent13 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Reference to a url resource + */ +export type Definition = { + type?: 'definition'; + identifier?: unknown; + label?: unknown; + url?: unknown; + title?: unknown; + position?: unknown; + data?: unknown; +} & Association4 & + Resource2 & + Node9; +/** + * Internal relation from one node to another + */ +export type Association4 = { + identifier: unknown; +} & OptionalAssociation; +export type Heading = { + type?: 'heading'; + depth: number; + /** + * count this heading for numbering based on kind, e.g. Section 2.4.1 + */ + enumerated?: boolean; + /** + * resolved enumerated value for this heading + */ + enumerator?: string; + children?: PhrasingContent[]; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & Parent14 & + OptionalAssociation1; +/** + * Basic node with required node children + */ +export type Parent14 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +export type ThematicBreak = { + type?: 'thematicBreak'; + position?: unknown; + data?: unknown; +} & Node10; +export type Blockquote = { + type?: 'blockquote'; + children?: FlowContent[]; + position?: unknown; + data?: unknown; +} & Parent15; +/** + * Basic node with required node children + */ +export type Parent15 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +export type List = { + type?: 'list'; + /** + * Is item order important or not? + */ + ordered?: boolean; + /** + * Starting number of ordered list + */ + start?: number; + /** + * One or more children are separated with a blank line from others + */ + spread?: boolean; + children?: ListContent[]; + position?: unknown; + data?: unknown; +} & Parent17; +export type ListContent = ListItem; +export type ListItem = { + type?: 'listItem'; + /** + * One or more children are separated with a blank line from others + */ + spread?: boolean; + children?: (PhrasingContent | FlowContent)[]; + position?: unknown; + data?: unknown; +} & Parent16; +/** + * Basic node with required node children + */ +export type Parent16 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Basic node with required node children + */ +export type Parent17 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Block of preformatted text + */ +export type Code = { + type?: 'code'; + /** + * language of the code + */ + lang?: string; + /** + * custom information relating to the node + */ + meta?: string; + /** + * user-defined class for code block + */ + class?: string; + showLineNumbers?: boolean; + startingLineNumber?: number; + emphasizeLines?: number[]; + identifier?: unknown; + label?: unknown; + value?: unknown; + position?: unknown; + data?: unknown; +} & {} & OptionalAssociation2 & + Literal4; +/** + * Basic node with required string value + */ +export type Literal4 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Comment nodes for comments present in myst but ignored upon render + */ +export type Comment = { + type?: 'mystComment'; + value?: unknown; + position?: unknown; + data?: unknown; +} & Literal5; +/** + * Basic node with required string value + */ +export type Literal5 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Target node - provides identifier/label for the following node + */ +export type Target = { + type?: 'mystTarget'; + /** + * unresolved target label + */ + label?: string; + position?: unknown; + data?: unknown; +} & Node11; +/** + * Content block with predefined behavior + */ +export type Directive = { + type?: 'mystDirective'; + name: string; + args?: string; + options?: { + [k: string]: unknown; + }; + /** + * body of the directive, excluding options + */ + value?: string; + /** + * parsed directive content + */ + children?: (FlowContent | PhrasingContent)[]; + position?: unknown; + data?: unknown; +} & Node12; +/** + * Admonition node for drawing attention to text, separate from the neighboring content + */ +export type Admonition = { + type?: 'admonition'; + /** + * kind of admonition, to determine styling + */ + kind?: + | 'attention' + | 'caution' + | 'danger' + | 'error' + | 'hint' + | 'important' + | 'note' + | 'seealso' + | 'tip' + | 'warning'; + /** + * admonition class info to override kind + */ + class?: string; + /** + * An optional `admonitionTitle` followed by the admonitions content. + */ + children?: (AdmonitionTitle | FlowContent)[]; + position?: unknown; + data?: unknown; +} & Node13; +/** + * Custom title for admonition, replaces kind as title + */ +export type AdmonitionTitle = { + type?: 'admonitionTitle'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent18; +/** + * Basic node with required node children + */ +export type Parent18 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Top-level container node to provide association and numbering to child content + */ +export type Container = { + type?: 'container'; + /** + * kind of container contents + */ + kind: 'figure' | 'table'; + /** + * any custom class information + */ + class?: string; + /** + * count this container for numbering based on kind, e.g. Figure 1a + */ + enumerated?: boolean; + /** + * resolved enumerated value for this container + */ + enumerator?: string; + children?: (Caption | Legend | Image | Table)[]; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & {} & OptionalAssociation3 & + Parent24; +/** + * Caption for container content + */ +export type Caption = { + type?: 'caption'; + children?: FlowContent[]; + position?: unknown; + data?: unknown; +} & Parent19; +/** + * Basic node with required node children + */ +export type Parent19 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Legend for container content + */ +export type Legend = { + type?: 'legend'; + children?: FlowContent[]; + position?: unknown; + data?: unknown; +} & Parent20; +/** + * Basic node with required node children + */ +export type Parent20 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Two-dimensional table data + */ +export type Table = { + type?: 'table'; + align?: 'left' | 'center' | 'right'; + children?: TableRow[]; + position?: unknown; + data?: unknown; +} & Parent23; +/** + * One row of table containing cells + */ +export type TableRow = { + type?: 'tableRow'; + children?: TableCell[]; + position?: unknown; + data?: unknown; +} & Parent22; +/** + * One cell of table + */ +export type TableCell = { + type?: 'tableCell'; + header?: boolean; + /** + * alignment of content within cell + */ + align?: 'left' | 'center' | 'right'; + children?: PhrasingContent[]; + position?: unknown; + data?: unknown; +} & Parent21; +/** + * Basic node with required node children + */ +export type Parent21 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Basic node with required node children + */ +export type Parent22 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Basic node with required node children + */ +export type Parent23 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Basic node with required node children + */ +export type Parent24 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Math node for presenting numbered equations + */ +export type Math = { + type?: 'math'; + /** + * count this math block for numbering based on kind, e.g. See equation (1a) + */ + enumerated?: boolean; + /** + * resolved enumerated value for this math block + */ + enumerator?: string; + identifier?: unknown; + label?: unknown; + value?: unknown; + position?: unknown; + data?: unknown; +} & OptionalAssociation4 & + Literal6; +/** + * Basic node with required string value + */ +export type Literal6 = { + /** + * The value of the node + */ + value: string; +} & Node; +/** + * Rich footnote content associated with footnote reference + */ +export type FootnoteDefinition = { + type?: 'footnoteDefinition'; + children?: FlowContent[]; + identifier?: unknown; + label?: unknown; + position?: unknown; + data?: unknown; +} & Association5 & + Parent25; +/** + * Internal relation from one node to another + */ +export type Association5 = { + identifier: unknown; +} & OptionalAssociation; +/** + * Basic node with required node children + */ +export type Parent25 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; +/** + * Top-level break in the myst document, breaking it into Blocks + */ +export type BlockBreak = { + type?: 'blockBreak'; + /** + * Block metadata. Conventionally this is a stringified JSON dictionary but it may be any arbitrary string. + */ + meta?: string; + position?: unknown; + data?: unknown; +} & Node15; +/** + * Basic node with required node children + */ +export type Parent26 = { + /** + * List of children nodes + */ + children: Node1[]; +} & Node2; + +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * location of node in source file; must not be present for generated nodes + */ +export interface Position { + start: Point; + end: Point1; + /** + * start column at each index in the source region, for elements that span multiple lines + */ + indent?: number[]; +} +/** + * place of first character of parsed source region + */ +export interface Point { + /** + * line in the source file, 1-indexed + */ + line: number; + /** + * column in the source file, 1-indexed + */ + column: number; + /** + * offset character in the source file, 0-indexed + */ + offset?: number; +} +/** + * place of first character after parsed source region, whether it exists or not + */ +export interface Point1 { + /** + * line in the source file, 1-indexed + */ + line: number; + /** + * column in the source file, 1-indexed + */ + column: number; + /** + * offset character in the source file, 0-indexed + */ + offset?: number; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node1 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node2 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node3 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Reference to external resource + */ +export interface Resource { + /** + * A Uniform Resource Locator (URL) to an external resource or link. + */ + url: string; + /** + * advisory information, e.g. for a tooltip + */ + title?: string; +} +/** + * Alternative description of image + */ +export interface Alternative { + /** + * field describing the image + */ + alt?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node4 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Marker associated to another node + */ +export interface Reference { + /** + * explicitness of the reference: + * `shortcut` - reference is implicit, identifier inferred + * `collapsed` - reference explicit, identifier inferred + * `full` - reference explicit, identifier explicit + */ + referenceType: 'shortcut' | 'collapsed' | 'full'; +} +/** + * Internal relation from one node to another; not required by node + */ +export interface OptionalAssociation { + /** + * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + */ + identifier?: string; + /** + * node label; character escapes and references are parsed; may be normalized to a unique identifier + */ + label?: string; +} +/** + * Alternative description of image + */ +export interface Alternative1 { + /** + * field describing the image + */ + alt?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node5 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node6 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Reference to external resource + */ +export interface Resource1 { + /** + * A Uniform Resource Locator (URL) to an external resource or link. + */ + url: string; + /** + * advisory information, e.g. for a tooltip + */ + title?: string; +} +/** + * Marker associated to another node + */ +export interface Reference1 { + /** + * explicitness of the reference: + * `shortcut` - reference is implicit, identifier inferred + * `collapsed` - reference explicit, identifier inferred + * `full` - reference explicit, identifier explicit + */ + referenceType: 'shortcut' | 'collapsed' | 'full'; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node7 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node8 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Reference to external resource + */ +export interface Resource2 { + /** + * A Uniform Resource Locator (URL) to an external resource or link. + */ + url: string; + /** + * advisory information, e.g. for a tooltip + */ + title?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node9 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Internal relation from one node to another; not required by node + */ +export interface OptionalAssociation1 { + /** + * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + */ + identifier?: string; + /** + * node label; character escapes and references are parsed; may be normalized to a unique identifier + */ + label?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node10 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Internal relation from one node to another; not required by node + */ +export interface OptionalAssociation2 { + /** + * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + */ + identifier?: string; + /** + * node label; character escapes and references are parsed; may be normalized to a unique identifier + */ + label?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node11 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node12 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node13 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Internal relation from one node to another; not required by node + */ +export interface OptionalAssociation3 { + /** + * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + */ + identifier?: string; + /** + * node label; character escapes and references are parsed; may be normalized to a unique identifier + */ + label?: string; +} +/** + * Internal relation from one node to another; not required by node + */ +export interface OptionalAssociation4 { + /** + * identifier that may match another node; value is unparsed and must be normalized such that whitespace is collapsed to single space, initial/final space is trimmed, and case is folded + */ + identifier?: string; + /** + * node label; character escapes and references are parsed; may be normalized to a unique identifier + */ + label?: string; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node14 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} +/** + * Base node object, based on the [unist](https://github.com/syntax-tree/unist) syntax tree. + */ +export interface Node15 { + /** + * identifier for node variant + */ + type: string; + /** + * information associated by the ecosystem with the node; never specified by mdast + */ + data?: { + [k: string]: unknown; + }; + position?: Position; +} diff --git a/packages/myst-spec/src/search.ts b/packages/myst-spec/src/search.ts new file mode 100644 index 000000000..451854322 --- /dev/null +++ b/packages/myst-spec/src/search.ts @@ -0,0 +1,48 @@ +// Search types + +/** + * Hierarchy of headers in a document + */ +export type DocumentHierarchy = { + lvl1?: string; + lvl2?: string; + lvl3?: string; + lvl4?: string; + lvl5?: string; + lvl6?: string; +}; + +/** + * Base type for search records + */ +export type SearchRecordBase = { + hierarchy: DocumentHierarchy; + url: string; + + position: number; +}; + +/** + * Record pertaining to section headings + */ +export type HeadingRecord = SearchRecordBase & { + type: keyof DocumentHierarchy; +}; + +/** + * Record pertaining to section content + */ +export type ContentRecord = SearchRecordBase & { + type: 'content'; + content: string; +}; + +/** + * Indexed search record type + */ +export type SearchRecord = HeadingRecord | ContentRecord; + +export type MystSearchIndex = { + version: '1'; + records: SearchRecord[]; +}; From a540867226779e21d07e089344fa625b97c2a72c Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Thu, 11 Jun 2026 13:43:13 +0100 Subject: [PATCH 13/14] =?UTF-8?q?=E2=9C=8D=EF=B8=8F=20Remove=20old=20READM?= =?UTF-8?q?E=20docs=20about=20`myst-spec`=20(#2952)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: remove old docs * chore: add changeset --- .changeset/proud-items-smash.md | 5 +++++ packages/myst-spec/README.md | 34 --------------------------------- 2 files changed, 5 insertions(+), 34 deletions(-) create mode 100644 .changeset/proud-items-smash.md diff --git a/.changeset/proud-items-smash.md b/.changeset/proud-items-smash.md new file mode 100644 index 000000000..c386ba219 --- /dev/null +++ b/.changeset/proud-items-smash.md @@ -0,0 +1,5 @@ +--- +'myst-spec': patch +--- + +Remove old docs for myst-spec diff --git a/packages/myst-spec/README.md b/packages/myst-spec/README.md index d603874a6..2bafdfd6a 100644 --- a/packages/myst-spec/README.md +++ b/packages/myst-spec/README.md @@ -51,37 +51,3 @@ Markdown AST, or `mdast`, is an intermediate format that builds upon the existin Beyond CommonMark and GitHub Flavoured Markdown, MyST introduces new directives and roles (like admonitions, citations, equations) following existing standards where they are defined. `mdast` is serializable to JSON or YAML, and can be effectively shared between projects, languages and implementations. The output of this repository is a versioned JSON file that can be used in implementations of MyST. -### Structure of the Repository - -``` -schema/ -|- myst.schema.json // root schema definition -|- myst.md // docs -|- schema.spec.ts // test for validating all examples against the schema -|- unist/ -| |- unist.schema.json // unist base types -| |- unist.md // docs -| |- unist.yml // example mdast structures -|- commonmark/ -| |- commonmark.schema.json // commonmark mdast types -| |- commonmark.md // docs -| |- commonmark.yml // simple commonmark examples -| |- cmark_spec_0.30.yml // commonmark spec examples -... -|- roles/ // future myst features -| |- roles.schema.json -| ... -|- directives/ -| |- directives.schema.json -| ... -``` - -## Relation to other markup languages, frameworks - -[TODO] - -- CommonMark -- GitHub Flavored Markdown -- Pandoc -- Unified -- Markdown-It From b27300b6e50baec44f252c55e0f3cbd6a57c7e70 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Thu, 11 Jun 2026 14:19:21 +0100 Subject: [PATCH 14/14] =?UTF-8?q?=F0=9F=93=A6=20Vendor=20`markdown-it-myst?= =?UTF-8?q?-extras`=20into=20`markdown-it-myst`=20(#2953)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bun.lock | 33 ++-- packages/markdown-it-myst/src/block.ts | 175 ++++++++++++++++++ packages/markdown-it-myst/src/colonFence.ts | 124 +++++++++++++ packages/markdown-it-myst/src/index.ts | 6 +- packages/markdown-it-myst/tests/cases.spec.ts | 5 +- .../markdown-it-myst/tests/directives.spec.ts | 6 +- packages/markdown-it-myst/tests/footnotes.yml | 3 +- packages/markdown-it-myst/tests/roles.spec.ts | 6 +- packages/myst-parser/docs/index.md | 2 - packages/myst-parser/package.json | 1 - packages/myst-parser/src/myst.ts | 9 +- packages/myst-parser/src/plugins.ts | 10 +- .../src/types/markdown-it-plugins/index.d.ts | 1 - 13 files changed, 347 insertions(+), 34 deletions(-) create mode 100644 packages/markdown-it-myst/src/block.ts create mode 100644 packages/markdown-it-myst/src/colonFence.ts diff --git a/bun.lock b/bun.lock index b03679b93..de69f493d 100644 --- a/bun.lock +++ b/bun.lock @@ -242,8 +242,8 @@ "csv-parse": "^5.5.5", "js-yaml": "^4.1.0", "json5": "^1.0.2", - "myst-common": "^1.9.5", - "myst-spec-ext": "^1.9.5", + "myst-common": "^1.10.0", + "myst-spec-ext": "^1.10.0", "nanoid": "^5.1.6", "unist-util-select": "^4.0.3", "vfile": "^5.3.7", @@ -394,12 +394,11 @@ "markdown-it-dollarmath": "^0.5.0", "markdown-it-footnote": "^4.0.0", "markdown-it-front-matter": "^0.2.3", - "markdown-it-myst": "1.0.16", - "markdown-it-myst-extras": "0.3.0", + "markdown-it-myst": "1.0.17", "markdown-it-task-lists": "^2.1.1", - "myst-common": "^1.9.5", - "myst-directives": "^1.7.0", - "myst-roles": "^1.7.0", + "myst-common": "^1.10.0", + "myst-directives": "^1.7.3", + "myst-roles": "^1.7.3", "myst-spec": "^0.0.5", "unified": "^10.1.1", "unist-builder": "^3.0.0", @@ -415,8 +414,8 @@ "@types/js-yaml": "^4.0.5", "@types/mdast": "^3.0.10", "js-yaml": "^4.1.0", - "myst-to-html": "^1.7.0", - "myst-transforms": "^1.3.47", + "myst-to-html": "^1.7.3", + "myst-transforms": "^1.3.50", "rehype-stringify": "^9.0.3", }, }, @@ -424,8 +423,8 @@ "name": "myst-roles", "version": "1.7.3", "dependencies": { - "myst-common": "^1.9.5", - "myst-spec-ext": "^1.9.5", + "myst-common": "^1.10.0", + "myst-spec-ext": "^1.10.0", }, }, "packages/myst-spec": { @@ -488,7 +487,7 @@ "mdast": "^3.0.0", "mdast-util-find-and-replace": "^2.1.0", "mdast-util-to-hast": "^12.3.0", - "myst-common": "^1.9.5", + "myst-common": "^1.10.0", "rehype-format": "^4.0.1", "rehype-parse": "^8.0.4", "rehype-remark": "^9.1.2", @@ -597,11 +596,11 @@ "js-yaml": "^4.1.0", "katex": "^0.15.2", "mdast-util-find-and-replace": "^2.1.0", - "myst-common": "^1.9.5", - "myst-frontmatter": "^1.9.5", + "myst-common": "^1.10.0", + "myst-frontmatter": "^1.10.0", "myst-spec": "^0.0.5", - "myst-spec-ext": "^1.9.5", - "myst-to-html": "1.7.0", + "myst-spec-ext": "^1.10.0", + "myst-to-html": "1.7.3", "rehype-parse": "^8.0.4", "rehype-remark": "^9.1.2", "unified": "^10.0.0", @@ -1865,8 +1864,6 @@ "markdown-it-myst": ["markdown-it-myst@workspace:packages/markdown-it-myst"], - "markdown-it-myst-extras": ["markdown-it-myst-extras@0.3.0", "", { "peerDependencies": { "markdown-it": "^12 || ^13" } }, "sha512-678qviK97MEzSM9Hr0jlX5nBPzMcKZo6Ixgh4nEf/WYpii8LXQ72FametoXkzyDy77qNKDE3vlqYhqfbbCGHrw=="], - "markdown-it-task-lists": ["markdown-it-task-lists@2.1.1", "", {}, "sha512-TxFAc76Jnhb2OUu+n3yz9RMu4CwGfaT788br6HhEDlvWfdeJcLUsxk1Hgw2yJio0OXsxv7pyIPmvECY7bMbluA=="], "markdown-table": ["markdown-table@3.0.3", "", {}, "sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw=="], diff --git a/packages/markdown-it-myst/src/block.ts b/packages/markdown-it-myst/src/block.ts new file mode 100644 index 000000000..ebfc9a607 --- /dev/null +++ b/packages/markdown-it-myst/src/block.ts @@ -0,0 +1,175 @@ +import type MarkdownIt from 'markdown-it/lib/index.js'; +import type StateBlock from 'markdown-it/lib/rules_block/state_block.js'; +import type Token from 'markdown-it/lib/token.js'; + +/** Parse MyST targets (``(name)=``), blockquotes (``% comment``) and block breaks (``+++``). + * + * Adapted from: mdit_py_plugins/myst_blocks/index.py + */ +export function blockPlugin(md: MarkdownIt): void { + md.block.ruler.before('blockquote', 'myst_line_comment', parse_line_comment, { + alt: ['paragraph', 'reference', 'blockquote', 'list', 'footnote_def'], + }); + md.block.ruler.before('hr', 'myst_block_break', parse_block_break, { + alt: ['paragraph', 'reference', 'blockquote', 'list', 'footnote_def'], + }); + md.block.ruler.before('hr', 'myst_target', parse_target, { + alt: ['paragraph', 'reference', 'blockquote', 'list', 'footnote_def'], + }); + md.renderer.rules.myst_line_comment = render_myst_line_comment; + md.renderer.rules.myst_target = render_myst_target; +} + +function parse_line_comment( + state: StateBlock, + startLine: number, + endLine: number, + silent: boolean, +): boolean { + let pos = state.bMarks[startLine] + state.tShift[startLine]; + let maximum = state.eMarks[startLine]; + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + + if (state.src[pos] !== '%') { + return false; + } + + if (silent) { + return true; + } + + const token = state.push('myst_line_comment', '', 0); + token.attrSet('class', 'myst-line-comment'); + token.content = state.src.slice(pos + 1, maximum).replace(/\s+$/gm, ''); // rstrip + token.markup = '%'; + + // search end of block while appending lines to `token.content` + let nextLine: number; + for (nextLine = startLine + 1; nextLine < endLine; nextLine++) { + pos = state.bMarks[nextLine] + state.tShift[nextLine]; + maximum = state.eMarks[nextLine]; + if (state.src[pos] !== '%') { + break; + } + token.content += '\n' + state.src.slice(pos + 1, maximum).replace(/\s+$/gm, ''); // rstrip + } + state.line = nextLine; + token.map = [startLine, nextLine]; + + return true; +} + +function parse_block_break( + state: StateBlock, + startLine: number, + endLine: number, + silent: boolean, +): boolean { + let pos = state.bMarks[startLine] + state.tShift[startLine]; + const maximum = state.eMarks[startLine]; + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + + const marker = state.src.charCodeAt(pos); + pos += 1; + + // Check block marker /* + */ + if (marker !== 0x2b) { + return false; + } + + // markers can be mixed with spaces, but there should be at least 3 of them + + let cnt = 1; + while (pos < maximum) { + const ch = state.src.charCodeAt(pos); + if (ch !== marker && !state.md.utils.isSpace(ch)) { + break; + } + if (ch === marker) { + cnt += 1; + } + pos += 1; + } + + if (cnt < 3) { + return false; + } + + if (silent) { + return true; + } + + state.line = startLine + 1; + + const token = state.push('myst_block_break', 'hr', 0); + token.attrSet('class', 'myst-block'); + token.content = state.src.slice(pos, maximum).trim(); + token.map = [startLine, state.line]; + token.markup = state.md.utils.fromCodePoint(marker).repeat(cnt); + + return true; +} + +const TARGET_PATTERN = /^\((?