Skip to content

Commit 75bbb18

Browse files
agoose77rowanc1
andauthored
⬆️ Add simple upgrade/downgrade package for MyST AST (#1802)
Co-authored-by: Rowan Cockett <rowanc1@gmail.com>
1 parent 7448083 commit 75bbb18

File tree

28 files changed

+719
-20
lines changed

28 files changed

+719
-20
lines changed

.changeset/eight-tools-live.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"myst-transforms": patch
3+
"myst-spec-ext": patch
4+
"myst-to-docx": patch
5+
"myst-config": patch
6+
"myst-cli": patch
7+
---
8+
9+
Change footnotes to use enumerator over number

.changeset/eleven-keys-explain.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"myst-config": patch
3+
---
4+
5+
Add version to config file

.changeset/red-suits-hug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"myst-cli": patch
3+
---
4+
5+
Add version to site content outputs

.changeset/sour-spiders-push.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'myst-migrate': patch
3+
---
4+
5+
Add myst-migrate package

docs/myst.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ project:
153153
- file: document-parts.md
154154
- file: settings.md
155155
- file: glossary.md
156+
- file: versions.md
156157
- title: Contribute
157158
children:
158159
- file: contributing.md

docs/versions.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: MyST Content Versions
3+
---
4+
5+
The following page describes changes to the MyST content that is served from the `.json` endpoint of a MyST Site. The `myst-compat` package can be used to translate between versions by upgrading and downgrading between versions.
6+
7+
The version is a string integer (i.e. `'1'` or `'2'`) and is incremented with every change to the content of a MyST page, which includes metadata as well as the MyST AST.
8+
9+
# MyST Versions
10+
11+
## Version 1 - 2025-02-07 - Footnote Numbering
12+
13+
The footnotes have dropped backwards compatibility with `number`, instead using `enumerator` on both the `FootnoteReference` and `FootnoteDefinition` nodes.
14+
Previous versions of the AST had both of these defined. The `enumerator` property is used in all other numberings of figures, sections, equations, etc.
15+
16+
## Version 0 - Pre 2025-02-01
17+
18+
This is the first version of MyST AST considered to be versioned, subsequent releases will have changes for migrating the content between versions.

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/myst-cli/src/build/cff.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import type { ExportWithOutput, ExportFnOptions } from './types.js';
1515
import { cleanOutput } from './utils/cleanOutput.js';
1616
import { getFileContent } from './utils/getFileContent.js';
1717
import { resolveFrontmatterParts } from '../utils/resolveFrontmatterParts.js';
18-
import { parseMyst } from '../process/myst.js';
1918

2019
function exportOptionsToCFF(exportOptions: ExportWithOutput): CFF {
2120
// Handle overlap of key "format" between CFF and export

packages/myst-cli/src/build/site/manifest.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { collectExportOptions } from '../utils/collectExportOptions.js';
2626
import { filterPages } from '../../project/load.js';
2727
import { getRawFrontmatterFromFile } from '../../process/file.js';
2828
import { castSession } from '../../session/cache.js';
29+
import { SPEC_VERSION } from '../../spec-version.js';
2930

3031
type ManifestProject = Required<SiteManifest>['projects'][0];
3132

@@ -417,9 +418,10 @@ export async function getSiteManifest(
417418
validatedFrontmatter.options = resolvedOptions;
418419
const parts = resolveFrontmatterParts(session, validatedFrontmatter);
419420
const manifest: SiteManifest = {
421+
version: SPEC_VERSION,
422+
myst: version,
420423
...validatedFrontmatter,
421424
parts,
422-
myst: version,
423425
nav: nav || [],
424426
actions: actions || [],
425427
projects: siteProjects,

packages/myst-cli/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export * from './session/index.js';
1010
export * from './store/index.js';
1111
export * from './transforms/index.js';
1212
export * from './utils/index.js';
13+
export * from './spec-version.js';
1314
export { default as version } from './version.js';

0 commit comments

Comments
 (0)