diff --git a/package-lock.json b/package-lock.json index 39c876be..64e1e5a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31182,13 +31182,13 @@ } }, "node_modules/myst-common": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/myst-common/-/myst-common-1.7.2.tgz", - "integrity": "sha512-xWYABtbIHNrX087EmwyuoSwhl9oJQfQ+3+6H+lv+bfLWRE1DZO4lr03113rjE4/I1IvjZgX3rE4Nb+SLF83DFQ==", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/myst-common/-/myst-common-1.7.3.tgz", + "integrity": "sha512-eHZ1iHOk+Agob5s+Oni7DVkicBCaEtNE1tQPkI4XYP8hZPPkE5F/qUmaL9ijw3z9y3KPs/XBT2dPSLYRwU80hA==", "license": "MIT", "dependencies": { "mdast": "^3.0.0", - "myst-frontmatter": "^1.7.2", + "myst-frontmatter": "^1.7.3", "myst-spec": "^0.0.5", "nanoid": "^4.0.0", "unified": "^10.1.2", @@ -31215,13 +31215,13 @@ } }, "node_modules/myst-config": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/myst-config/-/myst-config-1.7.2.tgz", - "integrity": "sha512-JuV54yVuMfgYGGFihNc/WDZ180smNer4wuw3jk7osmcow/CsldCWwXKNB44AO/Ii96aVLZCyPPm2CyhlE4W5pw==", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/myst-config/-/myst-config-1.7.3.tgz", + "integrity": "sha512-f8l6vejVWSxJp1jeTz9ni/AiaEQz8n+fAIxfVrEUjlKYp9f+Y90DdUYsBgbUu0R2LJJ76Bt/WUnRh3NZFR461Q==", "license": "MIT", "dependencies": { - "myst-common": "^1.7.2", - "myst-frontmatter": "^1.7.2", + "myst-common": "^1.7.3", + "myst-frontmatter": "^1.7.3", "simple-validators": "^1.1.0" } }, @@ -31310,9 +31310,9 @@ } }, "node_modules/myst-frontmatter": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/myst-frontmatter/-/myst-frontmatter-1.7.2.tgz", - "integrity": "sha512-J2kvADyifsGkawRL8M96i3MIxCu3Z6JliBNYsEEfFGEJRGIzMtNAyJlLlu836QqQoBVV7WaRY5Dc6aYgSxqPUw==", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/myst-frontmatter/-/myst-frontmatter-1.7.3.tgz", + "integrity": "sha512-abgMy6COBGXZwcNKPXPUAWQp34WLDFWLiZJDV3CzNamiGHa/r2ymuGRmV3yLBWc1NACYwn2RQ+zEOaX3tP2WaA==", "license": "MIT", "dependencies": { "credit-roles": "^2.1.0", @@ -31383,9 +31383,9 @@ "license": "MIT" }, "node_modules/myst-spec-ext": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/myst-spec-ext/-/myst-spec-ext-1.7.2.tgz", - "integrity": "sha512-oYDMHicKW3tm16OwnsTTiAo0hYMXBK1v8MDFZyHzavb2Q8artsqyAl/O2N0cefM5zI8L2JdMHhewd9tcx9iwvA==", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/myst-spec-ext/-/myst-spec-ext-1.7.3.tgz", + "integrity": "sha512-YOqwnSTImGnIEFk/g8NWmMWiJh96Xp17V+0vNCuVleGxDd7HI588FcnptLYCTp+3SENzIRVBztS8JjHxNi+V4Q==", "license": "MIT", "dependencies": { "myst-spec": "^0.0.5" @@ -31566,14 +31566,14 @@ } }, "node_modules/myst-to-typst": { - "version": "0.0.24", - "resolved": "https://registry.npmjs.org/myst-to-typst/-/myst-to-typst-0.0.24.tgz", - "integrity": "sha512-d13fSRBGk+kdEaF5tX0T/RsmdGPkO1hSxcX+v5vvRE3wvhhSFVpD8tACxK+IHhZC7XrUUR+RZ7/F6KXPvpoIyw==", + "version": "0.0.25", + "resolved": "https://registry.npmjs.org/myst-to-typst/-/myst-to-typst-0.0.25.tgz", + "integrity": "sha512-akTsKaqFrsmiCLQOyxzeJYyUvXkDX2Y2T4Ir7gXIW8Cl/sjX9Jo807yNE8VV5LjFZzJHc597gCErQXSLOnCXZw==", "license": "MIT", "dependencies": { - "myst-common": "^1.7.2", - "myst-frontmatter": "^1.7.2", - "myst-spec-ext": "^1.7.2", + "myst-common": "^1.7.3", + "myst-frontmatter": "^1.7.3", + "myst-spec-ext": "^1.7.3", "tex-to-typst": "^0.0.7", "unist-util-select": "^4.0.3", "vfile-reporter": "^7.0.4" @@ -40971,9 +40971,9 @@ "version": "0.13.2", "license": "MIT", "dependencies": { - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", - "myst-spec-ext": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", + "myst-spec-ext": "^1.7.3", "nbtx": "^0.2.3", "unist-util-select": "^4.0.3" } @@ -41062,11 +41062,11 @@ "buffer": "^6.0.3", "classnames": "^2.5.1", "jupyterlab-plotly": "^5.24.0", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", - "myst-frontmatter": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", + "myst-frontmatter": "^1.7.3", "myst-spec": "^0.0.5", - "myst-spec-ext": "^1.7.2", + "myst-spec-ext": "^1.7.3", "myst-to-react": "^0.13.2", "nanoid": "^4.0.2", "nbtx": "^0.2.3", @@ -41118,15 +41118,15 @@ "@heroicons/react": "^2.0.18", "classnames": "^2.3.2", "js-yaml": "^4.1.0", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", "myst-directives": "^1.5.7", "myst-ext-card": "^1.0.9", "myst-ext-exercise": "^1.0.8", "myst-ext-grid": "^1.0.8", "myst-ext-proof": "^1.0.11", "myst-ext-tabs": "^1.0.8", - "myst-frontmatter": "^1.7.2", + "myst-frontmatter": "^1.7.3", "myst-parser": "^1.5.7", "myst-spec": "^0.0.5", "myst-to-docx": "^1.0.12", @@ -41134,7 +41134,7 @@ "myst-to-jats": "^1.0.30", "myst-to-react": "^0.13.2", "myst-to-tex": "^1.0.38", - "myst-to-typst": "^0.0.24", + "myst-to-typst": "^0.0.25", "myst-transforms": "^1.3.26", "unified": "^10.1.2", "unist-util-remove": "^4.0.0", @@ -41183,8 +41183,8 @@ "@scienceicons/react": "^0.0.11", "buffer": "^6.0.3", "classnames": "^2.3.2", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", "myst-spec": "^0.0.5", "nanoid": "^4.0.2", "react-syntax-highlighter": "15.5.0", @@ -41243,9 +41243,9 @@ "peerDependencies": { "@types/react": "^16.8 || ^17.0 || ^18.0", "@types/react-dom": "^16.8 || ^17.0 || ^18.0", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", - "myst-frontmatter": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", + "myst-frontmatter": "^1.7.3", "react": "^16.8 || ^17.0 || ^18.0", "react-dom": "^16.8 || ^17.0 || ^18.0" } @@ -41285,10 +41285,10 @@ "@radix-ui/react-visually-hidden": "^1.1.0", "classnames": "^2.3.2", "lodash.throttle": "^4.1.1", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", "myst-demo": "^0.13.2", - "myst-spec-ext": "^1.7.2", + "myst-spec-ext": "^1.7.3", "myst-to-react": "^0.13.2", "nbtx": "^0.2.3", "node-cache": "^5.1.2", @@ -41349,8 +41349,8 @@ "@remix-run/node": "~1.17.0", "@remix-run/react": "~1.17.0", "@remix-run/vercel": "~1.17.0", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", "node-fetch": "^2.6.11", "react": "^18.2.0", "react-dom": "^18.2.0" @@ -41382,8 +41382,8 @@ "@remix-run/node": "~1.17.0", "@remix-run/react": "~1.17.0", "@remix-run/vercel": "~1.17.0", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", "node-fetch": "^2.6.11", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/packages/common/package.json b/packages/common/package.json index aba63e4d..6d41674c 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -19,9 +19,9 @@ "build": "npm-run-all -l clean -p build:esm" }, "dependencies": { - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", - "myst-spec-ext": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", + "myst-spec-ext": "^1.7.3", "nbtx": "^0.2.3", "unist-util-select": "^4.0.3" } diff --git a/packages/common/src/utils.ts b/packages/common/src/utils.ts index 11ee658b..6eea17a1 100644 --- a/packages/common/src/utils.ts +++ b/packages/common/src/utils.ts @@ -4,6 +4,7 @@ import type { SiteManifest } from 'myst-config'; import { selectAll } from 'unist-util-select'; import type { Image as ImageSpec, Link as LinkSpec } from 'myst-spec'; import type { FooterLinks, Heading, NavigationLink, PageLoader } from './types.js'; +import { slugToUrl } from 'myst-common'; type Image = ImageSpec & { urlOptimized?: string }; type Link = LinkSpec & { static?: boolean }; @@ -40,7 +41,7 @@ export function getProjectHeadings( }, ...project.pages.map((p) => { if (!('slug' in p)) return p; - const slug = p.slug?.replace(/\.index$/, '').replaceAll('.', '/'); + const slug = slugToUrl(p.slug); return { ...p, path: projectSlug && project.slug ? `/${project.slug}/${slug}` : `/${slug}`, diff --git a/packages/jupyter/package.json b/packages/jupyter/package.json index 24e8dfed..22a05788 100644 --- a/packages/jupyter/package.json +++ b/packages/jupyter/package.json @@ -30,11 +30,11 @@ "buffer": "^6.0.3", "classnames": "^2.5.1", "jupyterlab-plotly": "^5.24.0", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", - "myst-frontmatter": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", + "myst-frontmatter": "^1.7.3", "myst-spec": "^0.0.5", - "myst-spec-ext": "^1.7.2", + "myst-spec-ext": "^1.7.3", "myst-to-react": "^0.13.2", "nanoid": "^4.0.2", "nbtx": "^0.2.3", diff --git a/packages/myst-demo/package.json b/packages/myst-demo/package.json index ef1c8fee..51ef71c5 100644 --- a/packages/myst-demo/package.json +++ b/packages/myst-demo/package.json @@ -23,15 +23,15 @@ "@heroicons/react": "^2.0.18", "classnames": "^2.3.2", "js-yaml": "^4.1.0", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", "myst-directives": "^1.5.7", "myst-ext-card": "^1.0.9", "myst-ext-exercise": "^1.0.8", "myst-ext-grid": "^1.0.8", "myst-ext-proof": "^1.0.11", "myst-ext-tabs": "^1.0.8", - "myst-frontmatter": "^1.7.2", + "myst-frontmatter": "^1.7.3", "myst-parser": "^1.5.7", "myst-spec": "^0.0.5", "myst-to-docx": "^1.0.12", @@ -39,7 +39,7 @@ "myst-to-jats": "^1.0.30", "myst-to-react": "^0.13.2", "myst-to-tex": "^1.0.38", - "myst-to-typst": "^0.0.24", + "myst-to-typst": "^0.0.25", "myst-transforms": "^1.3.26", "unified": "^10.1.2", "unist-util-remove": "^4.0.0", diff --git a/packages/myst-to-react/package.json b/packages/myst-to-react/package.json index 48ae8437..880af189 100644 --- a/packages/myst-to-react/package.json +++ b/packages/myst-to-react/package.json @@ -26,8 +26,8 @@ "@radix-ui/react-hover-card": "^1.0.6", "buffer": "^6.0.3", "classnames": "^2.3.2", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", "myst-spec": "^0.0.5", "nanoid": "^4.0.2", "react-syntax-highlighter": "15.5.0", diff --git a/packages/providers/package.json b/packages/providers/package.json index 3fd379e4..6089b466 100644 --- a/packages/providers/package.json +++ b/packages/providers/package.json @@ -27,9 +27,9 @@ "peerDependencies": { "@types/react": "^16.8 || ^17.0 || ^18.0", "@types/react-dom": "^16.8 || ^17.0 || ^18.0", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", - "myst-frontmatter": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", + "myst-frontmatter": "^1.7.3", "react": "^16.8 || ^17.0 || ^18.0", "react-dom": "^16.8 || ^17.0 || ^18.0" }, diff --git a/packages/site/package.json b/packages/site/package.json index 33dcb88d..be272bbc 100644 --- a/packages/site/package.json +++ b/packages/site/package.json @@ -35,10 +35,10 @@ "@radix-ui/react-visually-hidden": "^1.1.0", "classnames": "^2.3.2", "lodash.throttle": "^4.1.1", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", "myst-demo": "^0.13.2", - "myst-spec-ext": "^1.7.2", + "myst-spec-ext": "^1.7.3", "myst-to-react": "^0.13.2", "nbtx": "^0.2.3", "node-cache": "^5.1.2", diff --git a/packages/site/src/seo/sitemap.ts b/packages/site/src/seo/sitemap.ts index e2fd552c..c9bf279e 100644 --- a/packages/site/src/seo/sitemap.ts +++ b/packages/site/src/seo/sitemap.ts @@ -1,3 +1,4 @@ +import { slugToUrl } from 'myst-common'; import type { SiteManifest } from 'myst-config'; type ManifestProjectItem = Required['projects'][0]['pages'][0]; @@ -148,10 +149,7 @@ export function getSiteSlugs( const projectSlug = project.slug ? `/${project.slug}` : ''; const pages = project.pages .filter((page): page is ManifestProjectItem => 'slug' in page) - .map( - (page) => - `${baseurl}${projectSlug}/${page.slug?.replace(/\.index$/, '').replace(/\./g, '/')}`, - ); + .map((page) => `${baseurl}${projectSlug}/${slugToUrl(page.slug)}`); if (opts?.excludeIndex) return [...pages]; return [ opts?.explicitIndex diff --git a/themes/article/package.json b/themes/article/package.json index 7b1cb230..5ac2349f 100644 --- a/themes/article/package.json +++ b/themes/article/package.json @@ -25,8 +25,8 @@ "@remix-run/node": "~1.17.0", "@remix-run/react": "~1.17.0", "@remix-run/vercel": "~1.17.0", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", "node-fetch": "^2.6.11", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/themes/book/app/utils/loaders.server.ts b/themes/book/app/utils/loaders.server.ts index 672ef860..daef0345 100644 --- a/themes/book/app/utils/loaders.server.ts +++ b/themes/book/app/utils/loaders.server.ts @@ -10,6 +10,7 @@ import { import { redirect } from '@remix-run/node'; import { responseNoArticle, responseNoSite, getDomainFromRequest } from '@myst-theme/site'; import type { MystSearchIndex } from '@myst-theme/search'; +import { slugToUrl } from 'myst-common'; const CONTENT_CDN_PORT = process.env.CONTENT_CDN_PORT ?? '3100'; const CONTENT_CDN = process.env.CONTENT_CDN ?? `http://localhost:${CONTENT_CDN_PORT}`; @@ -66,7 +67,7 @@ export async function getPage( throw redirect(projectName ? `/${projectName}` : '/'); } if (opts.slug?.endsWith('.index') && opts.redirect) { - const newSlug = opts.slug.replace(/\.index$/, '').replace(/\./g, '/'); + const newSlug = slugToUrl(opts.slug); throw redirect(projectName ? `/${projectName}/${newSlug}` : `/${newSlug}`); } let slug = opts.loadIndexPage || opts.slug == null ? project.index : opts.slug; diff --git a/themes/book/package.json b/themes/book/package.json index 2d240df2..b629a5b0 100644 --- a/themes/book/package.json +++ b/themes/book/package.json @@ -25,8 +25,8 @@ "@remix-run/node": "~1.17.0", "@remix-run/react": "~1.17.0", "@remix-run/vercel": "~1.17.0", - "myst-common": "^1.7.2", - "myst-config": "^1.7.2", + "myst-common": "^1.7.3", + "myst-config": "^1.7.3", "node-fetch": "^2.6.11", "react": "^18.2.0", "react-dom": "^18.2.0"