@mgks/docmd 0.1.4 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -4
- package/assets/css/welcome.css +5 -377
- package/assets/images/preview-dark-1.webp +0 -0
- package/assets/images/preview-dark-2.webp +0 -0
- package/assets/images/preview-dark-3.webp +0 -0
- package/assets/images/preview-light-1.webp +0 -0
- package/assets/images/preview-light-2.webp +0 -0
- package/assets/images/preview-light-3.webp +0 -0
- package/config.js +40 -6
- package/docs/configuration.md +82 -7
- package/docs/content/containers/buttons.md +88 -0
- package/docs/content/containers/callouts.md +154 -0
- package/docs/content/containers/cards.md +93 -0
- package/docs/content/containers/index.md +35 -0
- package/docs/content/containers/nested-containers.md +329 -0
- package/docs/content/containers/steps.md +175 -0
- package/docs/content/containers/tabs.md +228 -0
- package/docs/content/custom-containers.md +19 -124
- package/docs/content/frontmatter.md +2 -2
- package/docs/content/no-style-example.md +2 -0
- package/docs/content/no-style-pages.md +52 -28
- package/docs/index.md +55 -27
- package/docs/plugins/seo.md +80 -31
- package/docs/theming/available-themes.md +17 -2
- package/docs/theming/light-dark-mode.md +12 -3
- package/package.json +21 -9
- package/src/assets/css/docmd-main.css +5 -806
- package/src/assets/css/docmd-theme-retro.css +9 -0
- package/src/assets/css/docmd-theme-ruby.css +7 -604
- package/src/assets/css/docmd-theme-sky.css +7 -649
- package/src/assets/js/docmd-image-lightbox.js +4 -2
- package/src/assets/js/docmd-main.js +157 -0
- package/src/commands/build.js +62 -120
- package/src/commands/dev.js +2 -1
- package/src/commands/init.js +23 -1
- package/src/core/config-loader.js +2 -0
- package/src/core/file-processor.js +669 -373
- package/src/core/html-generator.js +49 -40
- package/src/core/icon-renderer.js +3 -2
- package/src/plugins/analytics.js +5 -1
- package/src/plugins/seo.js +114 -62
- package/src/plugins/sitemap.js +6 -0
- package/src/templates/layout.ejs +40 -8
- package/src/templates/no-style.ejs +23 -6
- package/src/templates/partials/theme-init.js +26 -0
- package/assets/images/preview-dark-1.png +0 -0
- package/assets/images/preview-dark-2.png +0 -0
- package/assets/images/preview-dark-3.png +0 -0
- package/assets/images/preview-light-1.png +0 -0
- package/assets/images/preview-light-2.png +0 -0
- package/assets/images/preview-light-3.png +0 -0
- package/src/assets/js/docmd-theme-toggle.js +0 -59
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// src/assets/js/theme-toggle.js
|
|
2
|
-
function applyTheme(theme, isInitialLoad = false) {
|
|
3
|
-
document.body.setAttribute('data-theme', theme);
|
|
4
|
-
if (!isInitialLoad) {
|
|
5
|
-
localStorage.setItem('docmd-theme', theme);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// Change highlight.js theme dynamically (if separate themes are loaded)
|
|
9
|
-
const highlightThemeLink = document.getElementById('highlight-theme');
|
|
10
|
-
if (highlightThemeLink) {
|
|
11
|
-
const isDark = theme.includes('dark');
|
|
12
|
-
const isLight = theme.includes('light');
|
|
13
|
-
const currentHref = highlightThemeLink.href;
|
|
14
|
-
|
|
15
|
-
if (isDark && currentHref.includes('docmd-highlight-light.css')) {
|
|
16
|
-
highlightThemeLink.href = currentHref.replace('docmd-highlight-light.css', 'docmd-highlight-dark.css');
|
|
17
|
-
} else if (isLight && currentHref.includes('docmd-highlight-dark.css')) {
|
|
18
|
-
highlightThemeLink.href = currentHref.replace('docmd-highlight-dark.css', 'docmd-highlight-light.css');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function getInitialTheme() {
|
|
24
|
-
const storedTheme = localStorage.getItem('docmd-theme');
|
|
25
|
-
if (storedTheme) {
|
|
26
|
-
return storedTheme;
|
|
27
|
-
}
|
|
28
|
-
// The server sets the initial data-theme based on config.theme.defaultMode.
|
|
29
|
-
// We respect localStorage first, then what the server provided.
|
|
30
|
-
// Optionally, could check prefers-color-scheme if neither is set, but defaultMode covers this.
|
|
31
|
-
return document.body.getAttribute('data-theme') || 'light';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
document.addEventListener('DOMContentLoaded', () => {
|
|
35
|
-
// Apply initial theme (respecting localStorage over server-rendered if set)
|
|
36
|
-
const initialTheme = getInitialTheme();
|
|
37
|
-
applyTheme(initialTheme, true); // true indicates it's the initial load
|
|
38
|
-
|
|
39
|
-
const themeToggleButton = document.getElementById('theme-toggle-button');
|
|
40
|
-
if (themeToggleButton) {
|
|
41
|
-
themeToggleButton.addEventListener('click', () => {
|
|
42
|
-
let currentTheme = document.body.getAttribute('data-theme');
|
|
43
|
-
|
|
44
|
-
// Handle both regular themes and sky theme variants
|
|
45
|
-
let newTheme;
|
|
46
|
-
if (currentTheme === 'light') {
|
|
47
|
-
newTheme = 'dark';
|
|
48
|
-
} else if (currentTheme === 'dark') {
|
|
49
|
-
newTheme = 'light';
|
|
50
|
-
} else if (currentTheme === 'sky-light') {
|
|
51
|
-
newTheme = 'sky-dark';
|
|
52
|
-
} else if (currentTheme === 'sky-dark') {
|
|
53
|
-
newTheme = 'sky-light';
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
applyTheme(newTheme); // isInitialLoad is false here, so it saves to localStorage
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
});
|