Skip to content

Commit

Permalink
change to myst-migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 committed Feb 8, 2025
1 parent d90645d commit fcfdf97
Show file tree
Hide file tree
Showing 34 changed files with 262 additions and 268 deletions.
9 changes: 9 additions & 0 deletions .changeset/eight-tools-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"myst-transforms": patch
"myst-spec-ext": patch
"myst-to-docx": patch
"myst-config": patch
"myst-cli": patch
---

Change footnotes to use enumerator over number
5 changes: 5 additions & 0 deletions .changeset/eleven-keys-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"myst-config": patch
---

Add version to config file
5 changes: 5 additions & 0 deletions .changeset/red-suits-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"myst-cli": patch
---

Add version to site content outputs
1 change: 1 addition & 0 deletions docs/myst.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ project:
- file: document-parts.md
- file: settings.md
- file: glossary.md
- file: versions.md
- title: Contribute
children:
- file: contributing.md
Expand Down
18 changes: 18 additions & 0 deletions docs/versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: MyST Content Versions
---

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.

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.

# MyST Versions

## Version 1 - 2025-02-07 - Footnote Numbering

The footnotes have dropped backwards compatibility with `number`, instead using `enumerator` on both the `FootnoteReference` and `FootnoteDefinition` nodes.
Previous versions of the AST had both of these defined. The `enumerator` property is used in all other numberings of figures, sections, equations, etc.

## Version 0 - Pre 2025-02-01

This is the first version of MyST AST considered to be versioned, subsequent releases will have changes for migrating the content between versions.
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/myst-cli/src/build/site/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { collectExportOptions } from '../utils/collectExportOptions.js';
import { filterPages } from '../../project/load.js';
import { getRawFrontmatterFromFile } from '../../process/file.js';
import { castSession } from '../../session/cache.js';
import { SPEC_VERSION } from '../../spec-version.js';

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

Expand Down Expand Up @@ -417,9 +418,10 @@ export async function getSiteManifest(
validatedFrontmatter.options = resolvedOptions;
const parts = resolveFrontmatterParts(session, validatedFrontmatter);
const manifest: SiteManifest = {
version: SPEC_VERSION,
myst: version,
...validatedFrontmatter,
parts,
myst: version,
nav: nav || [],
actions: actions || [],
projects: siteProjects,
Expand Down
2 changes: 1 addition & 1 deletion packages/myst-cli/src/process/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ export async function writeFile(
const parts = resolveFrontmatterParts(session, frontmatter);
const frontmatterWithExports = { ...frontmatter, exports, downloads, parts };
const mystData: MystData = {
version: SPEC_VERSION,
kind,
sha256,
slug,
Expand All @@ -422,7 +423,6 @@ export async function writeFile(
widgets,
mdast,
references,
version: SPEC_VERSION,
};
const jsonFilenameParts = [session.contentPath()];
if (projectSlug) jsonFilenameParts.push(projectSlug);
Expand Down
2 changes: 1 addition & 1 deletion packages/myst-cli/src/spec-version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SPEC_VERSION = '1';
export const SPEC_VERSION = 1;
2 changes: 1 addition & 1 deletion packages/myst-cli/src/transforms/crossReferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function mystDataFilename(dataUrl: string) {
}

export type MystData = {
version: number;
kind?: SourceFileKind;
sha256?: string;
slug?: string;
Expand All @@ -30,7 +31,6 @@ export type MystData = {
widgets?: Record<string, any>;
mdast?: GenericParent;
references?: References;
version?: string;
};

async function fetchMystData(
Expand Down
3 changes: 0 additions & 3 deletions packages/myst-compat/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions packages/myst-compat/src/downgrade/index.ts

This file was deleted.

62 changes: 0 additions & 62 deletions packages/myst-compat/src/downgrade/version_2_1.ts

This file was deleted.

21 changes: 0 additions & 21 deletions packages/myst-compat/src/index.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/myst-compat/src/types/index.ts

This file was deleted.

22 changes: 0 additions & 22 deletions packages/myst-compat/src/types/v1.ts

This file was deleted.

22 changes: 0 additions & 22 deletions packages/myst-compat/src/types/v2.ts

This file was deleted.

15 changes: 0 additions & 15 deletions packages/myst-compat/src/upgrade/index.ts

This file was deleted.

49 changes: 0 additions & 49 deletions packages/myst-compat/src/upgrade/version_1_2.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/myst-config/src/site/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type ManifestProject = {
} & Omit<ProjectFrontmatter, 'downloads' | 'exports' | 'parts'>;

export type SiteManifest = Omit<SiteFrontmatter, 'parts'> & {
version: number;
myst: string;
id?: string;
projects?: ManifestProject[];
Expand Down
File renamed without changes.
Loading

0 comments on commit fcfdf97

Please sign in to comment.