UNPKG

4.4 kBMarkdownView Raw
1# MyST Spec
2
3> :warning: The MyST AST specification is still in dev; any structures or features present in the JSON schema may change at any time without notice.
4
5MyST (Markedly Structured Text) is designed to create publication-quality, computational documents written entirely in Markdown. The main use case driving the development and design of MyST is [JupyterBook](https://jupyterbook.org/), which creates educational online textbooks and tutorials with Jupyter Notebooks and narrative content written in MyST.
6
7MyST is a superset of [CommonMark](https://commonmark.org/) (a standard form of Markdown) and allows you to directly create “directives” and “roles” as extension points in the language. These extensions points are influenced by [ReStructured Text (RST)](https://en.wikipedia.org/wiki/ReStructuredText) and [Sphinx](https://www.sphinx-doc.org/) -- pulling on the nomenclature and introducing additional standards where appropriate. `directives` are block-level extension points, like callout panels, tabs, figures or embedded charts; and `roles` are inline extension points, for components like references, citations, or inline math.
8
9````md
10```{directive} Argument
11The *content* of a directive can have {role}`with content`
12```
13````
14
15## Goals
16
17`myst-spec` is designed to standardize implementations and extensions to MyST, with the goal of making the MyST ecosystem as rich and interoperable as possible. The spec formalizes three formats:
18
191. the MyST markup syntax, to ensure MyST works as expected across languages and implementations;
202. the MyST abstract syntax tree (AST), to promote an ecosystem of transformations and exports to diverse formats (e.g. latex/word/html/docutils/etc.); and
213. suggested semantic HTML output and CSS class structure, to promote web-accessibility and interoperability of themes.
22
23The `myst-spec` will be improved overtime through enhancement proposals which can be submitted by our multi-stakeholder community. [IN PROGRESS]
24
25## MyST Spec
26
27This repository introduces tests to cover the MyST Spec. These tests cover three target formats: `myst`, `mdast`, and `html`. An simple example test case (in yaml) for a header looks like:
28
29```yaml
30cases:
31 - title: CommonMark headers
32 myst: |-
33 # Heading!
34 mdast:
35 type: root
36 children:
37 - type: heading
38 depth: 1
39 children:
40 - type: text
41 value: Heading!
42 html: |-
43 <h1>Heading!</h1>
44```
45
46[TBD: Do we include latex here, maybe?]
47
48### Markdown Abstract Syntax Tree, `mdast`
49
50Markdown AST, or `mdast`, is an intermediate format that builds upon the existing [mdast spec](https://github.com/syntax-tree/mdast), which is used throughout the [unifiedjs](https://unifiedjs.com/) Javascript community with hundreds of [existing transformations](https://unifiedjs.com/explore/), [utilities](https://unifiedjs.com/explore/keyword/unist-util/) and [serializers](https://unifiedjs.com/explore/keyword/rehype/). `mdast` is simple, with a `type` defining the node optional properties on the node and optional `children` (a leaf node has a `value`).
51
52Beyond 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.
53
54### Structure of the Repository
55
56```
57schema/
58|- myst.schema.json // root schema definition
59|- myst.md // docs
60|- schema.spec.ts // test for validating all examples against the schema
61|- unist/
62| |- unist.schema.json // unist base types
63| |- unist.md // docs
64| |- unist.yml // example mdast structures
65|- commonmark/
66| |- commonmark.schema.json // commonmark mdast types
67| |- commonmark.md // docs
68| |- commonmark.yml // simple commonmark examples
69| |- cmark_spec_0.30.yml // commonmark spec examples
70...
71|- roles/ // future myst features
72| |- roles.schema.json
73| ...
74|- directives/
75| |- directives.schema.json
76| ...
77```
78
79## Relation to other markup languages, frameworks
80
81[TODO]
82
83- CommonMark
84- GitHub Flavored Markdown
85- Pandoc
86- Unified
87- Markdown-It