From f9e5faba6d1fecd96b6224c3b68e5bc568ce7891 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Thu, 17 Oct 2024 13:38:43 +0100 Subject: [PATCH 1/8] docs: add docs for outputs --- docs/examples/outputs.yml | 45 +++++++++++++++++++++++++++++++++++++++ docs/features/outputs.md | 32 ++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 docs/examples/outputs.yml create mode 100644 docs/features/outputs.md diff --git a/docs/examples/outputs.yml b/docs/examples/outputs.yml new file mode 100644 index 0000000..e3a3435 --- /dev/null +++ b/docs/examples/outputs.yml @@ -0,0 +1,45 @@ +cases: + - title: output with children + mdast: + type: root + children: + - type: output + meta: + 'text/plain': Hello world! + children: + - type: paragraph + children: + - type: text + value: Hello world! + - title: output without children + mdast: + type: root + children: + - type: output + meta: + 'application/json': '{"foo": 12}' + children: [] + - title: outputs with children + mdast: + type: root + children: + - type: outputs + children: + - type: output + meta: + 'text/plain': Hello world! + children: + - type: paragraph + children: + - type: text + value: Hello world! + - title: outputs without children + mdast: + type: root + children: + - type: outputs + children: + - type: output + meta: + 'application/json': '{"foo": 12}' + children: [] diff --git a/docs/features/outputs.md b/docs/features/outputs.md new file mode 100644 index 0000000..066cf92 --- /dev/null +++ b/docs/features/outputs.md @@ -0,0 +1,32 @@ + +# Execution Outputs + +## Outputs + +`Outputs` provide a structural container for the outputs produced by a Jupyter kernel. + + +### Specification + +```{include} ../nodes/outputs.md +``` + +### Example + +```{include} ../examples/outputs.md +``` + +## Output + +Individual outputs from a Jupyer kernel may be embedded in an `output` node. + + +### Specification + +```{include} ../nodes/output.md +``` + +### Example + +```{include} ../examples/output.md +``` From 189a684a09b143e7fef8e12c6fe3cdd8742f84ef Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Fri, 18 Oct 2024 10:29:34 +0100 Subject: [PATCH 2/8] chore: add to toc --- docs/myst.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/myst.yml b/docs/myst.yml index b4f3c8f..384411e 100644 --- a/docs/myst.yml +++ b/docs/myst.yml @@ -8,6 +8,22 @@ project: subject: Specification venue: title: MyST Spec + + toc: + # Auto-generated by `myst init --write-toc` + - file: index.md + - file: features/overview.md + - file: features/commonmark.md + - file: features/admonitions.md + - file: features/figures.md + - file: features/tables.md + - file: features/math.md + - file: features/references.md + - file: features/footnotes.md + - file: features/blocks.md + - file: features/outputs.md + - file: myst.schema.md + site: title: MyST Spec actions: From 7e23360bdbf91f27b6a09928a3b63b31e84c3900 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Thu, 17 Oct 2024 13:45:03 +0100 Subject: [PATCH 3/8] feat: add new schema --- schema/outputs.schema.json | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 schema/outputs.schema.json diff --git a/schema/outputs.schema.json b/schema/outputs.schema.json new file mode 100644 index 0000000..7852a4b --- /dev/null +++ b/schema/outputs.schema.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://spec.myst.tools/json-schema/outputs.schema.json", + "description": "execution output container types", + "$defs": { + "Output": { + "type": "object", + "description": "Container for execution output from a Jupyer Kernel", + "allOf": [ + { + "properties": { + "type": { + "const": "output" + }, + "meta": { + "description": "Raw IOutput data", + "$ref": "https://raw.githubusercontent.com/jupyter/nbformat/refs/heads/main/nbformat/v4/nbformat.v4.5.schema.json#/definitions/output" + }, + "children": { + "description": "Children from parsing the raw IOutput data", + "type": "array", + "items": { + "$ref": "unist.schema.json#/$defs/node" + } + }, + "position": {}, + "data": {} + }, + "additionalProperties": false + }, + { "$ref": "unist.schema.json#/$defs/Parent" } + ] + }, + "Outputs": {:w + + "type": "object", + "description": "Container for a collection of execution outputs from a Jupyer Kernel", + "allOf": [ + { + "properties": { + "type": { + "const": "outputs" + }, + "children": { + "description": "Individual output nodes", + "type": "array", + "items": { + "$ref": "#/$defs/Output" + } + }, + "position": {}, + "data": {} + }, + "additionalProperties": false + }, + { "$ref": "unist.schema.json#/$defs/Parent" } + ] + } + + } +} From f2650d2d002b5a2b3785f1ac2ea74bf4ce72ac48 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Fri, 18 Oct 2024 10:29:59 +0100 Subject: [PATCH 4/8] chore: drop JB configs --- docs/_config.yml | 29 ----------------------------- docs/_toc.yml | 16 ---------------- 2 files changed, 45 deletions(-) delete mode 100644 docs/_config.yml delete mode 100644 docs/_toc.yml diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 62c7c0e..0000000 --- a/docs/_config.yml +++ /dev/null @@ -1,29 +0,0 @@ -# Jupyter Book settings -# Learn more at https://jupyterbook.org/customize/config.html - -title: '' -author: Executable Book Project -logo: images/logo-wide.svg - -# Force re-execution of notebooks on each build. -# See https://jupyterbook.org/content/execute.html -execute: - execute_notebooks: force - -# Define the name of the latex output file for PDF builds -latex: - latex_documents: - targetname: book.tex - -# Information about where the book exists on the web -repository: - url: https://github.com/executablebooks/myst-spec # Online location of your book - -# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository -html: - # favicon: images/favicon.ico - # google_analytics_id: G-XXX or UA-XXX - use_issues_button: true - use_repository_button: true - use_edit_page_button: true - extra_navbar: Maintained by Executable Books diff --git a/docs/_toc.yml b/docs/_toc.yml deleted file mode 100644 index 68370e4..0000000 --- a/docs/_toc.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Table of contents -# Learn more at https://jupyterbook.org/customize/toc.html - -format: jb-book -root: index -chapters: - - file: features/overview - - file: features/commonmark - - file: features/admonitions - - file: features/figures - - file: features/tables - - file: features/math - - file: features/references - - file: features/footnotes - - file: features/blocks - - file: myst.schema From fdbfefa200eb4d448f4510e7bcfe5bee4fc4b82c Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Fri, 18 Oct 2024 10:52:48 +0100 Subject: [PATCH 5/8] fix: typo --- schema/outputs.schema.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/schema/outputs.schema.json b/schema/outputs.schema.json index 7852a4b..822e6c6 100644 --- a/schema/outputs.schema.json +++ b/schema/outputs.schema.json @@ -31,8 +31,7 @@ { "$ref": "unist.schema.json#/$defs/Parent" } ] }, - "Outputs": {:w - + "Outputs": { "type": "object", "description": "Container for a collection of execution outputs from a Jupyer Kernel", "allOf": [ @@ -41,7 +40,7 @@ "type": { "const": "outputs" }, - "children": { + "children": { "description": "Individual output nodes", "type": "array", "items": { @@ -56,6 +55,5 @@ { "$ref": "unist.schema.json#/$defs/Parent" } ] } - } } From 3a638c8ad456e1a92e9a1ce41403f62e06e3f231 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Fri, 18 Oct 2024 10:59:09 +0100 Subject: [PATCH 6/8] test: skip tests without myst --- schema/schema.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/schema.spec.ts b/schema/schema.spec.ts index 5f534a0..a087824 100644 --- a/schema/schema.spec.ts +++ b/schema/schema.spec.ts @@ -79,7 +79,7 @@ const cases: [string, TestCase][] = files .filter(([f, t]) => { if (t.skip) skipped.push([f, t]); if (t.invalid) invalid.push([f, t]); - return !t.skip && !t.invalid; + return !t.skip && !t.invalid && t.myst !== undefined; }); describe('Valid Schema Tests', () => { From 2fd89522688a3d00539c6926c52b61153fb37a37 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Fri, 18 Oct 2024 12:15:47 +0100 Subject: [PATCH 7/8] fix: include outputs --- index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/index.ts b/index.ts index a87feac..2335a2d 100644 --- a/index.ts +++ b/index.ts @@ -315,6 +315,7 @@ const subschemas = [ 'comments', 'commonmark', 'unist', + 'outputs', ]; // Combine all schema files into the single myst schema document subschemas.forEach( From e2aadbdd637c783ee70399d05c989d73a46ae6c6 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Fri, 18 Oct 2024 13:17:56 +0100 Subject: [PATCH 8/8] fix: typo --- schema/outputs.schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/outputs.schema.json b/schema/outputs.schema.json index 822e6c6..94ed251 100644 --- a/schema/outputs.schema.json +++ b/schema/outputs.schema.json @@ -20,7 +20,7 @@ "description": "Children from parsing the raw IOutput data", "type": "array", "items": { - "$ref": "unist.schema.json#/$defs/node" + "$ref": "unist.schema.json#/$defs/Node" } }, "position": {},