@jet-w/astro-blog 0.1.0
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/dist/chunk-FXPGR372.js +0 -0
- package/dist/chunk-GYLSY3OJ.js +173 -0
- package/dist/config/index.d.ts +166 -0
- package/dist/config/index.js +38 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +59 -0
- package/dist/types/index.d.ts +75 -0
- package/dist/types/index.js +1 -0
- package/package.json +84 -0
- package/src/components/EChartsCard.vue +118 -0
- package/src/components/Mermaid.vue +73 -0
- package/src/components/about/ContentCard.astro +27 -0
- package/src/components/about/IconCard.astro +77 -0
- package/src/components/about/SocialLinks.astro +54 -0
- package/src/components/about/TagCard.astro +65 -0
- package/src/components/about/TagGroup.astro +33 -0
- package/src/components/about/TimelineCard.astro +52 -0
- package/src/components/blog/FloatingToc.vue +198 -0
- package/src/components/blog/Hero.astro +147 -0
- package/src/components/blog/NavigationTabs.vue +245 -0
- package/src/components/blog/PostCard.astro +161 -0
- package/src/components/blog/PostNavigation.astro +106 -0
- package/src/components/blog/RelatedPosts.astro +175 -0
- package/src/components/blog/TableOfContents.astro +153 -0
- package/src/components/blog/TagCloud.astro +91 -0
- package/src/components/home/FeaturedPostsSection.astro +54 -0
- package/src/components/home/QuickNavSection.astro +81 -0
- package/src/components/home/RecentPostsSection.astro +52 -0
- package/src/components/home/StatsSection.astro +44 -0
- package/src/components/layout/Footer.astro +103 -0
- package/src/components/layout/Header.astro +68 -0
- package/src/components/layout/Sidebar.astro +594 -0
- package/src/components/media/Bilibili.astro +114 -0
- package/src/components/media/Slides.astro +313 -0
- package/src/components/media/Video.astro +111 -0
- package/src/components/media/VideoPlayer.astro +89 -0
- package/src/components/media/YouTube.astro +92 -0
- package/src/components/pte/StudyCalendar.vue +1348 -0
- package/src/components/ui/Icon.astro +187 -0
- package/src/components/ui/MobileMenu.vue +201 -0
- package/src/components/ui/Pagination.astro +143 -0
- package/src/components/ui/SearchBox.vue +179 -0
- package/src/components/ui/SearchInterface.vue +409 -0
- package/src/components/ui/SidebarToggle.vue +57 -0
- package/src/components/ui/ThemeToggle.vue +90 -0
- package/src/layouts/AboutLayout.astro +18 -0
- package/src/layouts/BaseLayout.astro +362 -0
- package/src/layouts/PageLayout.astro +217 -0
- package/src/layouts/SlidesLayout.astro +320 -0
- package/src/plugins/rehype-clean-containers.mjs +24 -0
- package/src/plugins/rehype-relative-links.mjs +43 -0
- package/src/plugins/rehype-tabs.mjs +116 -0
- package/src/plugins/remark-containers.mjs +407 -0
- package/src/plugins/remark-mermaid.mjs +46 -0
- package/src/styles/global.css +870 -0
- package/src/styles/slides.css +220 -0
- package/src/utils/sidebar.ts +492 -0
- package/templates/default/astro.config.mjs +51 -0
- package/templates/default/content/pages/about.mdx +93 -0
- package/templates/default/content/pages/index.mdx +20 -0
- package/templates/default/content/posts/blog_docs/01-quick-start.md +162 -0
- package/templates/default/content/posts/blog_docs/02-frontmatter.md +277 -0
- package/templates/default/content/posts/blog_docs/03-markdown-basic.md +350 -0
- package/templates/default/content/posts/blog_docs/04-containers.md +331 -0
- package/templates/default/content/posts/blog_docs/05-code-blocks.md +388 -0
- package/templates/default/content/posts/blog_docs/06-mermaid.md +431 -0
- package/templates/default/content/posts/blog_docs/07-video.md +243 -0
- package/templates/default/content/posts/blog_docs/08-latex.md +382 -0
- package/templates/default/content/posts/blog_docs/09-icons.md +326 -0
- package/templates/default/content/posts/blog_docs/10-sidebar.md +445 -0
- package/templates/default/content/posts/blog_docs/11-config.md +334 -0
- package/templates/default/content/posts/blog_docs/12-slides.mdx +552 -0
- package/templates/default/content/posts/blog_docs/README.md +151 -0
- package/templates/default/content/slides/demo.md +146 -0
- package/templates/default/content/slides/docs/basic-demo.md +35 -0
- package/templates/default/content/slides/docs/code-demo.md +62 -0
- package/templates/default/content/slides/docs/echarts-demo.md +139 -0
- package/templates/default/content/slides/docs/fragment-demo.md +35 -0
- package/templates/default/content/slides/docs/math-demo.md +48 -0
- package/templates/default/content/slides/docs/mermaid-demo.md +105 -0
- package/templates/default/content/slides/docs/theme-demo.md +38 -0
- package/templates/default/content/slides/docs/vertical-demo.md +50 -0
- package/templates/default/package.json +31 -0
- package/templates/default/public/favicon-bak.svg +4 -0
- package/templates/default/public/images/avatar.jpg +0 -0
- package/templates/default/public/images/avatar.svg +142 -0
- package/templates/default/public/js/mermaid-container.js +402 -0
- package/templates/default/public/js/mermaid-init.js +131 -0
- package/templates/default/public/js/mermaid-render.js +98 -0
- package/templates/default/public/js/mermaid-simple.js +95 -0
- package/templates/default/public/js/tabs-init.js +86 -0
- package/templates/default/public/media/individual_portfolio/INDIVIDUAL PORTFOLIO.png +0 -0
- package/templates/default/public/slides/plugin/highlight/highlight.js +5 -0
- package/templates/default/public/slides/plugin/highlight/monokai.css +71 -0
- package/templates/default/public/slides/plugin/markdown/markdown.js +7 -0
- package/templates/default/public/slides/plugin/math/math.js +1 -0
- package/templates/default/public/slides/plugin/notes/notes.js +1 -0
- package/templates/default/public/slides/reveal.css +9 -0
- package/templates/default/public/slides/reveal.js +9 -0
- package/templates/default/public/slides/theme/beige.css +366 -0
- package/templates/default/public/slides/theme/black-contrast.css +362 -0
- package/templates/default/public/slides/theme/black.css +359 -0
- package/templates/default/public/slides/theme/blood.css +392 -0
- package/templates/default/public/slides/theme/dracula.css +385 -0
- package/templates/default/public/slides/theme/league.css +368 -0
- package/templates/default/public/slides/theme/moon.css +362 -0
- package/templates/default/public/slides/theme/night.css +360 -0
- package/templates/default/public/slides/theme/serif.css +363 -0
- package/templates/default/public/slides/theme/simple.css +362 -0
- package/templates/default/public/slides/theme/sky.css +370 -0
- package/templates/default/public/slides/theme/solarized.css +363 -0
- package/templates/default/public/slides/theme/white-contrast.css +362 -0
- package/templates/default/public/slides/theme/white.css +359 -0
- package/templates/default/public/slides/theme/white_contrast_compact_verbatim_headers.css +360 -0
- package/templates/default/public/test-complete.html +43 -0
- package/templates/default/public/test-mermaid.html +124 -0
- package/templates/default/src/config/index.ts +114 -0
- package/templates/default/src/content.config.ts +96 -0
- package/templates/default/src/pages/[...slug].astro +27 -0
- package/templates/default/src/pages/archives/[year]/[month]/page/[page].astro +176 -0
- package/templates/default/src/pages/archives/[year]/[month].astro +158 -0
- package/templates/default/src/pages/archives/index.astro +210 -0
- package/templates/default/src/pages/categories/[category]/page/[page].astro +218 -0
- package/templates/default/src/pages/categories/[category].astro +198 -0
- package/templates/default/src/pages/categories/index.astro +190 -0
- package/templates/default/src/pages/container-test.astro +79 -0
- package/templates/default/src/pages/mermaid-direct.html +78 -0
- package/templates/default/src/pages/posts/[...slug].astro +335 -0
- package/templates/default/src/pages/posts/index.astro +541 -0
- package/templates/default/src/pages/posts/page/[page].astro +146 -0
- package/templates/default/src/pages/rss.xml.ts +28 -0
- package/templates/default/src/pages/search-index.json.ts +21 -0
- package/templates/default/src/pages/search.astro +50 -0
- package/templates/default/src/pages/slides/[...slug].astro +54 -0
- package/templates/default/src/pages/slides/index.astro +135 -0
- package/templates/default/src/pages/tags/[tag]/page/[page].astro +211 -0
- package/templates/default/src/pages/tags/[tag].astro +191 -0
- package/templates/default/src/pages/tags/index.astro +167 -0
- package/templates/default/tailwind.config.mjs +78 -0
- package/templates/default/tsconfig.json +9 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Mermaid 渲染脚本
|
|
2
|
+
console.log('🎯 Mermaid render script loaded');
|
|
3
|
+
|
|
4
|
+
// 动态加载mermaid库并渲染图表
|
|
5
|
+
function loadMermaidAndRender() {
|
|
6
|
+
console.log('🚀 开始检查 mermaid 代码块');
|
|
7
|
+
|
|
8
|
+
// 检查是否有mermaid代码块
|
|
9
|
+
const mermaidBlocks = document.querySelectorAll('pre code[data-language="mermaid"], pre code.language-mermaid');
|
|
10
|
+
|
|
11
|
+
console.log(`🔍 找到 ${mermaidBlocks.length} 个mermaid代码块`);
|
|
12
|
+
|
|
13
|
+
if (mermaidBlocks.length === 0) {
|
|
14
|
+
console.log('❌ 没有找到mermaid代码块');
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 动态加载mermaid脚本
|
|
19
|
+
console.log('📥 开始加载 Mermaid 库');
|
|
20
|
+
const script = document.createElement('script');
|
|
21
|
+
script.src = 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js';
|
|
22
|
+
script.onload = function() {
|
|
23
|
+
console.log('✅ Mermaid库加载完成');
|
|
24
|
+
|
|
25
|
+
// 初始化mermaid
|
|
26
|
+
window.mermaid.initialize({
|
|
27
|
+
startOnLoad: false,
|
|
28
|
+
theme: 'default',
|
|
29
|
+
securityLevel: 'loose'
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
console.log('⚙️ Mermaid初始化完成');
|
|
33
|
+
|
|
34
|
+
// 处理每个mermaid代码块
|
|
35
|
+
mermaidBlocks.forEach(async function(block, index) {
|
|
36
|
+
try {
|
|
37
|
+
const code = block.textContent.trim();
|
|
38
|
+
const id = 'mermaid-diagram-' + index + '-' + Date.now();
|
|
39
|
+
|
|
40
|
+
console.log(`🎨 处理第${index+1}个图表: ${code.substring(0, 30)}...`);
|
|
41
|
+
|
|
42
|
+
// 使用mermaid渲染
|
|
43
|
+
const result = await window.mermaid.render(id, code);
|
|
44
|
+
|
|
45
|
+
console.log(`🎉 第${index+1}个图表SVG生成成功`);
|
|
46
|
+
|
|
47
|
+
// 创建容器
|
|
48
|
+
const container = document.createElement('div');
|
|
49
|
+
container.className = 'mermaid-container';
|
|
50
|
+
container.style.cssText = `
|
|
51
|
+
margin: 1.5rem 0;
|
|
52
|
+
padding: 1rem;
|
|
53
|
+
border: 1px solid #e2e8f0;
|
|
54
|
+
border-radius: 0.5rem;
|
|
55
|
+
background: white;
|
|
56
|
+
overflow-x: auto;
|
|
57
|
+
text-align: center;
|
|
58
|
+
`;
|
|
59
|
+
container.innerHTML = result.svg;
|
|
60
|
+
|
|
61
|
+
// 替换原始代码块
|
|
62
|
+
const preElement = block.closest('pre');
|
|
63
|
+
if (preElement && preElement.parentNode) {
|
|
64
|
+
preElement.parentNode.insertBefore(container, preElement);
|
|
65
|
+
preElement.remove();
|
|
66
|
+
console.log(`✨ 第${index+1}个图表渲染成功并替换完成`);
|
|
67
|
+
}
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error(`❌ 渲染第${index+1}个图表失败:`, error);
|
|
70
|
+
|
|
71
|
+
// 显示错误信息
|
|
72
|
+
const errorDiv = document.createElement('div');
|
|
73
|
+
errorDiv.style.cssText = 'color: red; padding: 1rem; border: 1px solid red; margin: 1rem 0; background: #fee;';
|
|
74
|
+
errorDiv.innerHTML = `<strong>Mermaid渲染错误:</strong> ${error.message}`;
|
|
75
|
+
|
|
76
|
+
const preElement = block.closest('pre');
|
|
77
|
+
if (preElement && preElement.parentNode) {
|
|
78
|
+
preElement.parentNode.insertBefore(errorDiv, preElement);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
script.onerror = function() {
|
|
85
|
+
console.error('❌ Mermaid库加载失败');
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
document.head.appendChild(script);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// 等待DOM加载完成后执行
|
|
92
|
+
if (document.readyState === 'loading') {
|
|
93
|
+
document.addEventListener('DOMContentLoaded', loadMermaidAndRender);
|
|
94
|
+
console.log('⏳ 等待DOM加载完成...');
|
|
95
|
+
} else {
|
|
96
|
+
console.log('📄 DOM已就绪,立即执行');
|
|
97
|
+
loadMermaidAndRender();
|
|
98
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// 简单的mermaid渲染脚本,不使用ES模块
|
|
2
|
+
(function() {
|
|
3
|
+
console.log('🎯 Simple Mermaid: 初始化开始');
|
|
4
|
+
|
|
5
|
+
// 检查mermaid是否已经加载
|
|
6
|
+
function waitForMermaid() {
|
|
7
|
+
if (window.mermaid) {
|
|
8
|
+
console.log('✅ Mermaid库已加载');
|
|
9
|
+
initializeMermaid();
|
|
10
|
+
} else {
|
|
11
|
+
console.log('⏳ 等待Mermaid库加载...');
|
|
12
|
+
setTimeout(waitForMermaid, 100);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function initializeMermaid() {
|
|
17
|
+
window.mermaid.initialize({
|
|
18
|
+
startOnLoad: false,
|
|
19
|
+
theme: 'default',
|
|
20
|
+
securityLevel: 'loose'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
processMermaidBlocks();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function processMermaidBlocks() {
|
|
27
|
+
console.log('🎯 开始处理mermaid代码块');
|
|
28
|
+
|
|
29
|
+
// 查找所有mermaid代码块
|
|
30
|
+
const codeBlocks = document.querySelectorAll('pre code[data-language="mermaid"], pre code.language-mermaid');
|
|
31
|
+
console.log(`🎯 找到 ${codeBlocks.length} 个mermaid代码块`);
|
|
32
|
+
|
|
33
|
+
codeBlocks.forEach(async (codeBlock, index) => {
|
|
34
|
+
try {
|
|
35
|
+
let mermaidCode = codeBlock.textContent.trim();
|
|
36
|
+
console.log(`🎯 处理第${index+1}个代码块:`, mermaidCode.substring(0, 50));
|
|
37
|
+
|
|
38
|
+
// 移除%%mermaid标记(如果存在)
|
|
39
|
+
if (mermaidCode.startsWith('%%mermaid')) {
|
|
40
|
+
mermaidCode = mermaidCode.substring('%%mermaid'.length).trim();
|
|
41
|
+
console.log('🎯 移除%%mermaid标记后:', mermaidCode.substring(0, 50));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const id = `mermaid-simple-${index}-${Date.now()}`;
|
|
45
|
+
|
|
46
|
+
// 使用mermaid.render方法
|
|
47
|
+
const { svg } = await window.mermaid.render(id, mermaidCode);
|
|
48
|
+
|
|
49
|
+
// 创建容器
|
|
50
|
+
const container = document.createElement('div');
|
|
51
|
+
container.className = 'mermaid-container';
|
|
52
|
+
container.style.cssText = 'margin: 1.5rem 0; padding: 1rem; border: 1px solid #e2e8f0; border-radius: 0.5rem; background: white;';
|
|
53
|
+
container.innerHTML = svg;
|
|
54
|
+
|
|
55
|
+
// 替换原始代码块
|
|
56
|
+
const preElement = codeBlock.closest('pre');
|
|
57
|
+
if (preElement && preElement.parentNode) {
|
|
58
|
+
preElement.parentNode.insertBefore(container, preElement);
|
|
59
|
+
preElement.style.display = 'none';
|
|
60
|
+
console.log(`✅ 第${index+1}个图表渲染成功`);
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error(`❌ 渲染第${index+1}个图表时出错:`, error);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
console.log('🎯 Mermaid处理完成');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 加载mermaid库
|
|
71
|
+
function loadMermaid() {
|
|
72
|
+
console.log('📥 开始加载Mermaid库');
|
|
73
|
+
const script = document.createElement('script');
|
|
74
|
+
script.src = 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js';
|
|
75
|
+
script.onload = function() {
|
|
76
|
+
console.log('✅ Mermaid库加载完成');
|
|
77
|
+
waitForMermaid();
|
|
78
|
+
};
|
|
79
|
+
script.onerror = function() {
|
|
80
|
+
console.error('❌ Mermaid库加载失败');
|
|
81
|
+
};
|
|
82
|
+
document.head.appendChild(script);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// 启动函数
|
|
86
|
+
function start() {
|
|
87
|
+
if (document.readyState === 'loading') {
|
|
88
|
+
document.addEventListener('DOMContentLoaded', loadMermaid);
|
|
89
|
+
} else {
|
|
90
|
+
loadMermaid();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
start();
|
|
95
|
+
})();
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabs component initialization script
|
|
3
|
+
* Handles tab switching functionality
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Global function for tab switching (called from onclick handlers)
|
|
7
|
+
window.switchTab = function(tabsId, tabIndex) {
|
|
8
|
+
const tabsContainer = document.querySelector(`[data-tabs-id="${tabsId}"]`);
|
|
9
|
+
if (!tabsContainer) return;
|
|
10
|
+
|
|
11
|
+
// Update buttons
|
|
12
|
+
const buttons = tabsContainer.querySelectorAll('.tab-button');
|
|
13
|
+
buttons.forEach((btn, idx) => {
|
|
14
|
+
if (idx === tabIndex) {
|
|
15
|
+
btn.classList.add('active');
|
|
16
|
+
} else {
|
|
17
|
+
btn.classList.remove('active');
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Update panels
|
|
22
|
+
const panels = tabsContainer.querySelectorAll('.tab-panel');
|
|
23
|
+
panels.forEach((panel, idx) => {
|
|
24
|
+
if (idx === tabIndex) {
|
|
25
|
+
panel.classList.add('active');
|
|
26
|
+
} else {
|
|
27
|
+
panel.classList.remove('active');
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Initialize all tabs on page load
|
|
33
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
34
|
+
initializeTabs();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Re-initialize on Astro page navigation (for view transitions)
|
|
38
|
+
document.addEventListener('astro:page-load', function() {
|
|
39
|
+
initializeTabs();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
function initializeTabs() {
|
|
43
|
+
const tabContainers = document.querySelectorAll('.custom-tabs');
|
|
44
|
+
|
|
45
|
+
tabContainers.forEach((container) => {
|
|
46
|
+
// Ensure first tab is active by default
|
|
47
|
+
const firstButton = container.querySelector('.tab-button');
|
|
48
|
+
const firstPanel = container.querySelector('.tab-panel');
|
|
49
|
+
|
|
50
|
+
if (firstButton && !container.querySelector('.tab-button.active')) {
|
|
51
|
+
firstButton.classList.add('active');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (firstPanel && !container.querySelector('.tab-panel.active')) {
|
|
55
|
+
firstPanel.classList.add('active');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Add keyboard navigation
|
|
59
|
+
const buttons = container.querySelectorAll('.tab-button');
|
|
60
|
+
buttons.forEach((button, index) => {
|
|
61
|
+
button.addEventListener('keydown', (e) => {
|
|
62
|
+
let newIndex = index;
|
|
63
|
+
|
|
64
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
newIndex = (index + 1) % buttons.length;
|
|
67
|
+
} else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
newIndex = (index - 1 + buttons.length) % buttons.length;
|
|
70
|
+
} else if (e.key === 'Home') {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
newIndex = 0;
|
|
73
|
+
} else if (e.key === 'End') {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
newIndex = buttons.length - 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (newIndex !== index) {
|
|
79
|
+
const tabsId = container.getAttribute('data-tabs-id');
|
|
80
|
+
window.switchTab(tabsId, newIndex);
|
|
81
|
+
buttons[newIndex].focus();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|