Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤖 Add outputs to spec #66

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions docs/_config.yml

This file was deleted.

16 changes: 0 additions & 16 deletions docs/_toc.yml

This file was deleted.

45 changes: 45 additions & 0 deletions docs/examples/outputs.yml
Original file line number Diff line number Diff line change
@@ -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: []
32 changes: 32 additions & 0 deletions docs/features/outputs.md
Original file line number Diff line number Diff line change
@@ -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
```
16 changes: 16 additions & 0 deletions docs/myst.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ const subschemas = [
'comments',
'commonmark',
'unist',
'outputs',
];
// Combine all schema files into the single myst schema document
subschemas.forEach(
Expand Down
59 changes: 59 additions & 0 deletions schema/outputs.schema.json
Original file line number Diff line number Diff line change
@@ -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" }
]
}
}
}
2 changes: 1 addition & 1 deletion schema/schema.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's nothing to test here -- outputs are programmatically generated.

});

describe('Valid Schema Tests', () => {
Expand Down
Loading