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

wip: try updating snapshots #208

Closed
wants to merge 5 commits into from
Closed
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
1 change: 1 addition & 0 deletions .github/workflows/update-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ jobs:
# Playwright knows how to start JupyterLab server
start_server_script: 'null'
test_folder: ui-tests
npm_client: jlpm
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,9 @@
"selector-no-vendor-prefix": null,
"value-no-vendor-prefix": null
}
},
"resolutions": {
"myst-spec": "0.0.4",
"myst-frontmatter": "1.1.22"
}
}
30 changes: 15 additions & 15 deletions src/myst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,24 @@ export async function processArticleMDAST(
article: mdast as any
};

const { frontmatter: frontmatterRaw } = getFrontmatter(file, mdast, {
removeYaml: true,
removeHeading: true
});
const { frontmatter: frontmatterRaw, identifiers } = getFrontmatter(
file,
mdast,
{}
);
const frontmatter = validatePageFrontmatter(frontmatterRaw, {
property: 'frontmatter',
messages: {}
});

const state = new ReferenceState({
const state = new ReferenceState('<internal>', {
numbering: frontmatter.numbering,
file
vfile: file,
identifiers
});
unified()
.use(mathPlugin, { macros: frontmatter?.math ?? {} }) // This must happen before enumeration, as it can add labels
.use(glossaryPlugin, { state }) // This should be before the enumerate plugins
.use(glossaryPlugin) // This should be before the enumerate plugins
.use(abbreviationPlugin, { abbreviations: frontmatter.abbreviations })
.use(enumerateTargetsPlugin, { state })
.use(linksPlugin, { transformers: linkTransforms })
Expand Down Expand Up @@ -158,29 +160,27 @@ export async function processNotebookMDAST(
cite: { order: [], data: {} },
article: mdast as any
};
const { frontmatter: frontmatterRaw } = getFrontmatter(
const { frontmatter: frontmatterRaw, identifiers } = getFrontmatter(
file,
// This is the first cell, which might have a YAML block or header.
mdast.children[0] as any,
{
removeYaml: true,
removeHeading: true
}
{}
);

const frontmatter = validatePageFrontmatter(frontmatterRaw, {
property: 'frontmatter',
messages: {}
});

const state = new ReferenceState({
const state = new ReferenceState('<internal>', {
numbering: frontmatter.numbering,
file
vfile: file,
identifiers
});

unified()
.use(mathPlugin, { macros: frontmatter?.math ?? {} }) // This must happen before enumeration, as it can add labels
.use(glossaryPlugin, { state }) // This should be before the enumerate plugins
.use(glossaryPlugin) // This should be before the enumerate plugins
.use(abbreviationPlugin, { abbreviations: frontmatter.abbreviations })
.use(enumerateTargetsPlugin, { state })
.use(linksPlugin, { transformers: linkTransforms })
Expand Down
Loading
Loading