From 80cac662ec826f273ee56403903842772d5ab07b Mon Sep 17 00:00:00 2001 From: Jan David Fischbach Date: Wed, 9 Aug 2023 00:37:19 +0200 Subject: [PATCH] expose firstTimeLong to project settings --- packages/myst-cli/src/process/mdast.ts | 2 +- packages/myst-frontmatter/src/frontmatter/types.ts | 1 + packages/myst-frontmatter/src/frontmatter/validators.ts | 5 +++++ packages/mystmd/package.json | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/myst-cli/src/process/mdast.ts b/packages/myst-cli/src/process/mdast.ts index f9e41a5c2..7bd7976e9 100644 --- a/packages/myst-cli/src/process/mdast.ts +++ b/packages/myst-cli/src/process/mdast.ts @@ -147,7 +147,7 @@ export async function transformMdast( .use(htmlPlugin, { htmlHandlers }) .use(mathPlugin, { macros: frontmatter.math }) .use(glossaryPlugin, { state }) // This should be before the enumerate plugins - .use(abbreviationPlugin, { abbreviations: frontmatter.abbreviations }) + .use(abbreviationPlugin, { abbreviations: frontmatter.abbreviations, firstTimeLong: frontmatter.firstTimeLong }) .use(enumerateTargetsPlugin, { state }) // This should be after math .use(joinGatesPlugin) .run(mdast, vfile); diff --git a/packages/myst-frontmatter/src/frontmatter/types.ts b/packages/myst-frontmatter/src/frontmatter/types.ts index 8ab2aa532..efee393ec 100644 --- a/packages/myst-frontmatter/src/frontmatter/types.ts +++ b/packages/myst-frontmatter/src/frontmatter/types.ts @@ -155,6 +155,7 @@ export type ProjectFrontmatter = SiteFrontmatter & { math?: Record; /** Abbreviations used throughout the project */ abbreviations?: Record; + firstTimeLong?: boolean; exports?: Export[]; thebe?: Thebe; requirements?: string[]; diff --git a/packages/myst-frontmatter/src/frontmatter/validators.ts b/packages/myst-frontmatter/src/frontmatter/validators.ts index 6c8a30f98..30fbcd15f 100644 --- a/packages/myst-frontmatter/src/frontmatter/validators.ts +++ b/packages/myst-frontmatter/src/frontmatter/validators.ts @@ -70,6 +70,7 @@ export const PROJECT_FRONTMATTER_KEYS = [ 'bibliography', 'math', 'abbreviations', + 'firstTimeLong', 'exports', // Do not add any project specific keys here! ].concat(SITE_FRONTMATTER_KEYS); @@ -94,6 +95,7 @@ export const USE_PROJECT_FALLBACK = [ 'subject', 'venue', 'biblio', + 'firstTimeLong', 'numbering', 'keywords', ]; @@ -751,6 +753,9 @@ export function validateSharedProjectFrontmatterKeys( if (defined(value.open_access)) { output.open_access = validateBoolean(value.open_access, incrementOptions('open_access', opts)); } + if (defined(value.firstTimeLong)) { + output.firstTimeLong = validateBoolean(value.firstTimeLong, incrementOptions('firstTimeLong', opts)); + } if (defined(value.license)) { output.license = validateLicenses(value.license, incrementOptions('license', opts)); } diff --git a/packages/mystmd/package.json b/packages/mystmd/package.json index 52699e1a4..7ef382f5c 100644 --- a/packages/mystmd/package.json +++ b/packages/mystmd/package.json @@ -32,7 +32,7 @@ "unlink": "npm uninstall -g mystmd", "link": "npm run unlink; npm link;", "copy:version": "echo \"const version = '\"$npm_package_version\"';\nexport default version;\" > src/version.ts", - "dev": "npm run link && esbuild src/index.ts --bundle --outfile=dist/myst.cjs --platform=node --external:fsevents --watch", + "dev": "npm run link && esbuild src/index.ts --bundle --outfile=dist/myst.cjs --platform=node --external:fsevents", "lint": "npm run copy:version; eslint \"src/**/*.ts\" -c .eslintrc.cjs", "lint:format": "npm run copy:version; prettier --check \"src/**/*.ts\"", "test": "npm run link; npm run copy:version; vitest run",