mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-23 12:46:36 +01:00
Compare commits
9 Commits
renovate/p
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5bc07dc0c | ||
|
|
80a686be03 | ||
|
|
d26f2c6043 | ||
|
|
8ca7a28bf3 | ||
|
|
6b77c9c4c7 | ||
|
|
7b167cf331 | ||
|
|
d435ac6fe1 | ||
|
|
ed96d067fc | ||
|
|
09c60be450 |
2
.github/workflows/e2e-timings.yml
vendored
2
.github/workflows/e2e-timings.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Commit and create pull request
|
||||
uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412
|
||||
uses: peter-evans/create-pull-request@0979079bc20c05bbbb590a56c21c4e2b1d1f1bbe
|
||||
with:
|
||||
add-paths: |
|
||||
cypress/timings.json
|
||||
|
||||
2
.github/workflows/update-browserlist.yml
vendored
2
.github/workflows/update-browserlist.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
message: 'chore: update browsers list'
|
||||
push: false
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7.0.11
|
||||
uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # v7.0.9
|
||||
with:
|
||||
branch: update-browserslist
|
||||
title: Update Browserslist
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@applitools/eyes-cypress": "^3.56.6",
|
||||
"@argos-ci/cypress": "^6.2.5",
|
||||
"@applitools/eyes-cypress": "^3.56.5",
|
||||
"@argos-ci/cypress": "^6.2.2",
|
||||
"@changesets/changelog-github": "^0.5.2",
|
||||
"@changesets/cli": "^2.29.8",
|
||||
"@cspell/eslint-plugin": "^9.3.2",
|
||||
@@ -77,7 +77,7 @@
|
||||
"@types/jsdom": "^21.1.7",
|
||||
"@types/lodash": "^4.17.21",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"@types/node": "^22.19.3",
|
||||
"@types/node": "^22.19.1",
|
||||
"@types/rollup-plugin-visualizer": "^5.0.3",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"@vitest/spy": "^3.2.4",
|
||||
|
||||
@@ -76,10 +76,10 @@
|
||||
"cytoscape-fcose": "^2.2.0",
|
||||
"d3": "^7.9.0",
|
||||
"d3-sankey": "^0.12.3",
|
||||
"dagre-d3-es": "7.0.14",
|
||||
"dagre-d3-es": "7.0.13",
|
||||
"dayjs": "^1.11.19",
|
||||
"dompurify": "^3.3.0",
|
||||
"katex": "^0.16.27",
|
||||
"dompurify": "^3.3.1",
|
||||
"katex": "^0.16.25",
|
||||
"khroma": "^2.1.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"marked": "^16.3.0",
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { CanonicalUrlConfig } from './canonical-urls.js';
|
||||
*/
|
||||
export const canonicalConfig: CanonicalUrlConfig = {
|
||||
// Base URL for the Mermaid documentation site
|
||||
baseUrl: 'https://docs.mermaidchart.com',
|
||||
baseUrl: 'https://mermaid.ai/open-source',
|
||||
|
||||
// Disable automatic generation - only use specificCanonicalUrls
|
||||
autoGenerate: false,
|
||||
@@ -57,93 +57,6 @@ export const canonicalConfig: CanonicalUrlConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Pages that should have specific canonical URLs
|
||||
*
|
||||
* Since autoGenerate is set to false, ONLY pages listed here will get canonical URLs.
|
||||
*
|
||||
* Usage: Add entries to this object where the key is the relative path
|
||||
* of the markdown file and the value is the desired canonical URL.
|
||||
*
|
||||
* Examples:
|
||||
* - 'intro/index.md': 'https://docs.mermaidchart.com/intro/index.html'
|
||||
* - 'syntax/flowchart.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/flowchart.html'
|
||||
* - 'config/configuration.md': 'https://docs.mermaidchart.com/mermaid-oss/config/configuration.html'
|
||||
*/
|
||||
export const specificCanonicalUrls: Record<string, string> = {
|
||||
// Add your specific canonical URLs here
|
||||
// Example:
|
||||
// 'syntax/flowchart.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/flowchart.html',
|
||||
|
||||
// Intro section
|
||||
'intro/index.md': 'https://docs.mermaidchart.com/intro/index.html',
|
||||
'intro/getting-started.md':
|
||||
'https://docs.mermaidchart.com/mermaid-oss/intro/getting-started.html',
|
||||
'intro/syntax-reference.md':
|
||||
'https://docs.mermaidchart.com/mermaid-oss/intro/syntax-reference.html',
|
||||
|
||||
// Syntax section
|
||||
'syntax/flowchart.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/flowchart.html',
|
||||
'syntax/sequenceDiagram.md':
|
||||
'https://docs.mermaidchart.com/mermaid-oss/syntax/sequenceDiagram.html',
|
||||
'syntax/classDiagram.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/classDiagram.html',
|
||||
'syntax/stateDiagram.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/stateDiagram.html',
|
||||
'syntax/entityRelationshipDiagram.md':
|
||||
'https://docs.mermaidchart.com/mermaid-oss/syntax/entityRelationshipDiagram.html',
|
||||
'syntax/userJourney.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/userJourney.html',
|
||||
'syntax/gantt.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/gantt.html',
|
||||
'syntax/pie.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/pie.html',
|
||||
'syntax/quadrantChart.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/quadrantChart.html',
|
||||
'syntax/requirementDiagram.md':
|
||||
'https://docs.mermaidchart.com/mermaid-oss/syntax/requirementDiagram.html',
|
||||
'syntax/mindmap.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/mindmap.html',
|
||||
'syntax/timeline.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/timeline.html',
|
||||
'syntax/gitgraph.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/gitgraph.html',
|
||||
'syntax/c4.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/c4.html',
|
||||
'syntax/sankey.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/sankey.html',
|
||||
'syntax/xyChart.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/xyChart.html',
|
||||
'syntax/block.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/block.html',
|
||||
'syntax/packet.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/packet.html',
|
||||
'syntax/kanban.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/kanban.html',
|
||||
'syntax/architecture.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/architecture.html',
|
||||
'syntax/radar.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/radar.html',
|
||||
'syntax/examples.md': 'https://docs.mermaidchart.com/mermaid-oss/syntax/examples.html',
|
||||
|
||||
// Config section
|
||||
'config/configuration.md': 'https://docs.mermaidchart.com/mermaid-oss/config/configuration.html',
|
||||
'config/usage.md': 'https://docs.mermaidchart.com/mermaid-oss/config/usage.html',
|
||||
'config/icons.md': 'https://docs.mermaidchart.com/mermaid-oss/config/icons.html',
|
||||
'config/directives.md': 'https://docs.mermaidchart.com/mermaid-oss/config/directives.html',
|
||||
'config/theming.md': 'https://docs.mermaidchart.com/mermaid-oss/config/theming.html',
|
||||
'config/math.md': 'https://docs.mermaidchart.com/mermaid-oss/config/math.html',
|
||||
'config/accessibility.md': 'https://docs.mermaidchart.com/mermaid-oss/config/accessibility.html',
|
||||
'config/mermaidCLI.md': 'https://docs.mermaidchart.com/mermaid-oss/config/mermaidCLI.html',
|
||||
'config/faq.md': 'https://docs.mermaidchart.com/mermaid-oss/config/faq.html',
|
||||
|
||||
// Ecosystem section
|
||||
'ecosystem/mermaid-chart.md':
|
||||
'https://docs.mermaidchart.com/mermaid-oss/ecosystem/mermaid-chart.html',
|
||||
'ecosystem/tutorials.md': 'https://docs.mermaidchart.com/mermaid-oss/ecosystem/tutorials.html',
|
||||
'ecosystem/integrations-community.md':
|
||||
'https://docs.mermaidchart.com/mermaid-oss/ecosystem/integrations-community.html',
|
||||
'ecosystem/integrations-create.md':
|
||||
'https://docs.mermaidchart.com/mermaid-oss/ecosystem/integrations-create.html',
|
||||
|
||||
// Community section
|
||||
'community/intro.md': 'https://docs.mermaidchart.com/mermaid-oss/community/intro.html',
|
||||
'community/contributing.md':
|
||||
'https://docs.mermaidchart.com/mermaid-oss/community/contributing.html',
|
||||
'community/new-diagram.md':
|
||||
'https://docs.mermaidchart.com/mermaid-oss/community/new-diagram.html',
|
||||
'community/questions-and-suggestions.md':
|
||||
'https://docs.mermaidchart.com/mermaid-oss/community/questions-and-suggestions.html',
|
||||
'community/security.md': 'https://docs.mermaidchart.com/mermaid-oss/community/security.html',
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function to get canonical URL for a specific page
|
||||
* This can be used in frontmatter or for manual overrides
|
||||
*/
|
||||
export function getCanonicalUrl(relativePath: string): string | undefined {
|
||||
return specificCanonicalUrls[relativePath];
|
||||
return `https://mermaid.ai/open-source/${relativePath}`;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { PageData } from 'vitepress';
|
||||
import { canonicalConfig, specificCanonicalUrls } from './canonical-config.js';
|
||||
import { canonicalConfig } from './canonical-config.js';
|
||||
|
||||
/**
|
||||
* Configuration for canonical URL generation
|
||||
@@ -48,31 +48,15 @@ const defaultConfig: CanonicalUrlConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if a path matches any of the exclude patterns
|
||||
*/
|
||||
function shouldExcludePath(relativePath: string, excludePatterns: string[] = []): boolean {
|
||||
return excludePatterns.some((pattern) => {
|
||||
// Convert glob pattern to regex
|
||||
const regexPattern = pattern
|
||||
.replace(/\*\*/g, '.*')
|
||||
.replace(/\*/g, '[^/]*')
|
||||
.replace(/\?/g, '.')
|
||||
.replace(/\./g, '\\.');
|
||||
const regex = new RegExp(`^${regexPattern}$`);
|
||||
return regex.test(relativePath);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform a relative path to a canonical URL path
|
||||
*/
|
||||
function transformPath(relativePath: string, config: CanonicalUrlConfig): string {
|
||||
export function transformPath(relativePath: string, config: CanonicalUrlConfig): string {
|
||||
let transformedPath = relativePath;
|
||||
|
||||
// Apply built-in transformations
|
||||
if (config.transformations?.removeMarkdownExtension) {
|
||||
transformedPath = transformedPath.replace(/\.md$/, '');
|
||||
transformedPath = transformedPath.replace(/\.md$/, '.html');
|
||||
}
|
||||
|
||||
if (config.transformations?.removeIndex) {
|
||||
@@ -116,45 +100,9 @@ function generateCanonicalUrl(relativePath: string, config: CanonicalUrlConfig):
|
||||
export function addCanonicalUrls(pageData: PageData): void {
|
||||
const config = canonicalConfig;
|
||||
|
||||
// Check for specific canonical URLs first
|
||||
const specificUrl = specificCanonicalUrls[pageData.relativePath];
|
||||
if (specificUrl) {
|
||||
addCanonicalToHead(pageData, specificUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip if canonical URL is already explicitly set in frontmatter
|
||||
if (pageData.frontmatter.canonical) {
|
||||
// If it's already a full URL, use as-is
|
||||
if (pageData.frontmatter.canonical.startsWith('http')) {
|
||||
addCanonicalToHead(pageData, pageData.frontmatter.canonical);
|
||||
return;
|
||||
}
|
||||
// If it's a relative path, convert to absolute URL
|
||||
const canonicalUrl = config.baseUrl + pageData.frontmatter.canonical;
|
||||
addCanonicalToHead(pageData, canonicalUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip if canonicalPath is set in frontmatter
|
||||
if (pageData.frontmatter.canonicalPath) {
|
||||
const canonicalUrl = config.baseUrl + pageData.frontmatter.canonicalPath;
|
||||
addCanonicalToHead(pageData, canonicalUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip if auto-generation is disabled
|
||||
if (!config.autoGenerate) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip if path should be excluded
|
||||
if (shouldExcludePath(pageData.relativePath, config.excludePatterns)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate canonical URL
|
||||
const canonicalUrl = generateCanonicalUrl(pageData.relativePath, config);
|
||||
transformPath(pageData.relativePath, config);
|
||||
addCanonicalToHead(pageData, canonicalUrl);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
"vue": "^3.5.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify-json/carbon": "^1.2.15",
|
||||
"@unocss/reset": "^66.5.10",
|
||||
"@iconify-json/carbon": "^1.2.14",
|
||||
"@unocss/reset": "^66.5.9",
|
||||
"@vite-pwa/vitepress": "^1.0.1",
|
||||
"@vitejs/plugin-vue": "^6.0.3",
|
||||
"@vitejs/plugin-vue": "^6.0.2",
|
||||
"fast-glob": "^3.3.3",
|
||||
"https-localhost": "^4.7.1",
|
||||
"pathe": "^2.0.3",
|
||||
"unocss": "^66.5.10",
|
||||
"unocss": "^66.5.9",
|
||||
"unplugin-vue-components": "^28.8.0",
|
||||
"vite": "^7.0.8",
|
||||
"vite-plugin-pwa": "^1.0.3",
|
||||
|
||||
1051
pnpm-lock.yaml
generated
1051
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user