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 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 +``` 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: 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( diff --git a/schema/outputs.schema.json b/schema/outputs.schema.json new file mode 100644 index 0000000..94ed251 --- /dev/null +++ b/schema/outputs.schema.json @@ -0,0 +1,59 @@ +{ + "$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": { + "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" } + ] + } + } +} 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', () => {