Merge branch 'master' into develop

* master:
  Revert "Add CNAME"
  fix Redirect
  fix: Remove basepath from docs
This commit is contained in:
Sidharth Vinod 2022-12-19 14:26:54 +05:30
commit 95e4443ff2
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
7 changed files with 8 additions and 11 deletions

View File

@ -1 +0,0 @@
mermaid.js.org

View File

@ -28,7 +28,7 @@
"docs:build": "rimraf ../../docs && pnpm docs:spellcheck && pnpm docs:code && ts-node-esm src/docs.mts",
"docs:verify": "pnpm docs:spellcheck && pnpm docs:code && ts-node-esm src/docs.mts --verify",
"docs:pre:vitepress": "rimraf src/vitepress && pnpm docs:code && ts-node-esm src/docs.mts --vitepress",
"docs:build:vitepress": "pnpm docs:pre:vitepress && vitepress build src/vitepress && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing && cpy --flat src/docs/CNAME ./src/vitepress/.vitepress/dist/",
"docs:build:vitepress": "pnpm docs:pre:vitepress && vitepress build src/vitepress && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing",
"docs:dev": "pnpm docs:pre:vitepress && concurrently \"vitepress dev src/vitepress\" \"ts-node-esm src/docs.mts --watch --vitepress\"",
"docs:serve": "pnpm docs:build:vitepress && vitepress serve src/vitepress",
"docs:spellcheck": "cspell --config ../../cSpell.json \"src/docs/**/*.md\"",

View File

@ -14,9 +14,9 @@ export default defineConfig({
lang: 'en-US',
title: 'Mermaid',
description: 'Create diagrams and visualizations using text and code.',
base: '/mermaid/',
base: '/',
markdown: allMarkdownTransformers,
head: [['link', { rel: 'icon', type: 'image/x-icon', href: '/mermaid/favicon.ico' }]],
head: [['link', { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]],
themeConfig: {
nav: nav(),
editLink: {

View File

@ -18,7 +18,7 @@ export default {
if (newPath) {
console.log(`Redirecting to ${newPath} from ${window.location}`);
// router.go isn't loading the ID properly.
window.location.href = `/mermaid/${newPath}`;
window.location.href = `/${newPath}`;
}
} catch (e) {}
};

View File

@ -8,6 +8,7 @@ test.each([
['http://localhost:1234/mermaid/#/flowchart.md', 'syntax/flowchart.html'],
['http://localhost/mermaid/#/flowchart.md', 'syntax/flowchart.html'],
['https://mermaid-js.github.io/mermaid/#/flowchart.md', 'syntax/flowchart.html'],
['https://mermaid.js.org/#/flowchart.md', 'syntax/flowchart.html'],
['https://mermaid-js.github.io/mermaid/#/./flowchart', 'syntax/flowchart.html'],
['https://mermaid-js.github.io/mermaid/#/flowchart', 'syntax/flowchart.html'],
['https://mermaid-js.github.io/mermaid/#flowchart', 'syntax/flowchart.html'],
@ -31,7 +32,4 @@ test.each([
test('should throw for invalid URL', () => {
// Not mermaid domain
expect(() => getRedirect('https://www.google.com')).toThrowError();
// Not `/mermaid/` path
expect(() => getRedirect('http://localhost/#/flowchart.md')).toThrowError();
});

View File

@ -10,8 +10,9 @@ export interface Redirect {
const getBaseFile = (link: string): Redirect => {
const url = new URL(link);
if (
(url.hostname !== 'mermaid-js.github.io' && url.hostname !== 'localhost') ||
url.pathname !== '/mermaid/'
url.hostname !== 'mermaid-js.github.io' &&
url.hostname !== 'mermaid.js.org' &&
url.hostname !== 'localhost'
) {
throw new Error('Not mermaidjs url');
}

View File

@ -1 +0,0 @@
mermaid.js.org