Skip to content

Commit 86bee62

Browse files
authored
feat: add Mermaid.js support for diagram rendering on GitHub Pages (#86)
* docs: improve documentation structure with unified command chains and cross-linking (#79) Co-authored-by: Dominikus Nold <[email protected]> * docs: add integrations overview guide (optional task 6.4) - Create integrations-overview.md with comprehensive overview of all integrations - Add links from integration guides to integrations-overview.md - Add link to integrations-overview.md in docs/README.md - Complete optional task 6.4 from improve-documentation-structure change * docs: fix linting errors in integrations-overview.md - Fix MD036 warnings by converting emphasis to proper headings - Fix MD040 warning by adding language specifier to code block * docs: simplify README and add links to new documentation - Update website links to specfact.com / .io / .dev - Add GitHub Pages docs link: https://nold-ai.github.io/specfact-cli/ - Remove version info section (avoids outdated info) - Simplify content - remove verbose sections, add links to docs instead - Add links to new documentation: - Command Chains Reference - Common Tasks Quick Reference - AI IDE Workflow Guide - Integrations Overview - Improve onboarding with clear path for new users * docs: add prominent SpecFact domain links with context - Add specfact.com, specfact.io, specfact.dev links prominently at top - Add domain purpose context (commercial, ecosystem, developer community) - Highlight specfact.dev for developers - Add GitHub Pages docs link - Improve user navigation to appropriate resources * docs: update Quick Start with correct IDE setup workflow - Add Step 2: Initialize IDE integration (specfact init --ide) - Update Step 3: Use slash commands in IDE or CLI - Add realistic timing expectations (10-15 min for typical repos) - Explain what init does (copies prompts, makes slash commands available) - Add link to AI IDE Workflow Guide - Remove unrealistic '60 seconds' claim * fix: correct heading level for SpecFact Domains section * docs: fix GitHub Pages permalinks for all documentation pages - Update permalinks to include full directory path (e.g., /reference/commands/ instead of /commands/) - Add frontmatter with permalinks to agile-scrum-workflows.md and reference/README.md - Add frontmatter with permalink to speckit-journey.md for consistency - All permalinks now match the Jekyll configuration pattern - Enables proper GitHub Pages URLs for platform-frontend sites * fix: resolve Jekyll build errors for GitHub Pages - Quote title in speckit-journey.md frontmatter to fix YAML parsing error - Wrap Jinja2 template code in {% raw %} tags in agile-scrum-workflows.md to prevent Jekyll from parsing it as Liquid syntax Fixes GitHub Pages build errors: - YAML Exception in speckit-journey.md (line 3) - Liquid syntax error in agile-scrum-workflows.md (line 708) * docs: add new pages to GitHub Pages navigation menu - Add Command Chains to Guides section - Add Agile/Scrum Workflows to Guides section - Add Reference Documentation index to Reference section These pages were missing from the navigation menu after fixing permalinks. * docs: add new pages to GitHub Pages sidebar navigation menu - Add Command Chains to Guides section (top of list) - Add Agile/Scrum Workflows to Guides section - Add Reference Documentation index to Reference section - Fix reference links to use correct permalinks (/reference/architecture/, etc.) The sidebar navigation menu is hardcoded in the layout file, so these pages need to be manually added to appear in the left sidebar. * feat: add Mermaid.js support for diagram rendering on GitHub Pages - Add Mermaid.js CDN script to layout - Add JavaScript to convert mermaid code blocks to renderable divs - Handle kramdown output format (pre > code.language-mermaid) - Initialize Mermaid with proper configuration Fixes Mermaid diagram rendering on GitHub Pages documentation. All mermaid code blocks will now render as interactive diagrams. --------- Co-authored-by: Dominikus Nold <[email protected]>
1 parent d2364aa commit 86bee62

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

docs/_layouts/default.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,39 @@
1010
{% if jekyll.environment == 'production' and site.google_analytics %}
1111
{% include google-analytics.html %}
1212
{% endif %}
13+
<!-- Mermaid.js for diagram rendering -->
14+
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
15+
<script>
16+
document.addEventListener('DOMContentLoaded', function() {
17+
// Find all mermaid code blocks (kramdown outputs: <pre><code class="language-mermaid">)
18+
const mermaidCodeBlocks = document.querySelectorAll('pre code.language-mermaid, code.language-mermaid');
19+
20+
mermaidCodeBlocks.forEach(function(codeBlock) {
21+
const pre = codeBlock.closest('pre');
22+
const mermaidCode = codeBlock.textContent || codeBlock.innerText;
23+
24+
// Create mermaid div
25+
const mermaidDiv = document.createElement('div');
26+
mermaidDiv.className = 'mermaid';
27+
mermaidDiv.textContent = mermaidCode.trim();
28+
29+
// Replace the entire pre block (or just the code if no pre)
30+
if (pre) {
31+
pre.parentNode.replaceChild(mermaidDiv, pre);
32+
} else {
33+
codeBlock.parentNode.replaceChild(mermaidDiv, codeBlock);
34+
}
35+
});
36+
37+
// Initialize Mermaid after converting all blocks
38+
mermaid.initialize({
39+
startOnLoad: true,
40+
theme: 'default',
41+
securityLevel: 'loose',
42+
flowchart: { useMaxWidth: true }
43+
});
44+
});
45+
</script>
1346
</head>
1447
<body>
1548
<header class="site-header" role="banner">

0 commit comments

Comments
 (0)