Skip to content

Commit 963ea9b

Browse files
committed
update
1 parent 423395d commit 963ea9b

File tree

9 files changed

+281
-20
lines changed

9 files changed

+281
-20
lines changed

docs/blog/2025/989-0906-逻辑系列中的Family和Prefix.md renamed to docs/blog/2025-09-06.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
# 0906-逻辑系列中的Family和Prefix
1+
---
2+
date: 2025-09-06
3+
authors: ['mikigo']
4+
description: '逻辑系列中的Family和Prefix'
5+
sidebar: false
6+
pageType: doc-wide
7+
---
8+
9+
# 逻辑系列中的Family和Prefix
210

311
### 一、最常见的原理图 Prefix(参考标识符)
412

docs/blog/2025/988-0909-在PCB设计中类、组合、簇是什么.md renamed to docs/blog/2025-09-09.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
# 0909-在PCB设计中类、组合、簇是什么
1+
---
2+
date: 2025-09-09
3+
authors: ['mikigo']
4+
description: '在PCB设计中类、组合、簇是什么'
5+
sidebar: false
6+
pageType: doc-wide
7+
---
8+
9+
# 在PCB设计中类、组合、簇是什么
210

311
### 1. 类 (Group / Class)
412

docs/blog/2026-02-07.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
date: 2026-02-07
3+
authors: ['mikigo']
4+
description: '我从 Pycharm 转向 VSCode 了'
5+
sidebar: false
6+
pageType: doc-wide
7+
---
8+
9+
# 拥抱 VSCode
10+
11+
我从 Pycharm 转向 VSCode 了

docs/blog/_meta.json

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
[
22
{
3-
"type": "file",
4-
"name": "index",
5-
"label": "预览"
3+
"type": "section-header",
4+
"label": "总览"
65
},
6+
"index",
77
{
8-
"type": "dir",
9-
"name": "2025",
10-
"label": "2025",
11-
"overviewHeaders": [1]
8+
"type": "section-header",
9+
"label": "博客"
1210
},
13-
{
14-
"type": "dir",
15-
"name": "2024",
16-
"label": "2024",
17-
"collapsed": true,
18-
"overviewHeaders": [1]
19-
}
11+
"2026-02-07",
12+
"2025-09-09",
13+
"2025-09-06"
2014
]

docs/blog/index.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/blog/index.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
pageType: doc-wide
3+
sidebar: false
4+
---
5+
6+
# mikigo's blog
7+
8+
import { BlogList } from '../components/Blog';
9+
10+
<BlogList />
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.avatarContainer {
2+
display: inline-flex;
3+
align-items: center;
4+
gap: 12px;
5+
padding: 8px 0;
6+
margin-right: 40px;
7+
}
8+
9+
.avatar {
10+
width: 48px;
11+
height: 48px;
12+
border-radius: 50%;
13+
object-fit: cover;
14+
flex-shrink: 0;
15+
pointer-events: none;
16+
}
17+
18+
.info {
19+
display: flex;
20+
flex-direction: column;
21+
}
22+
23+
.name {
24+
font-weight: 700;
25+
line-height: 1.25rem;
26+
font-size: 0.875rem;
27+
color: var(--rp-c-text-1);
28+
}
29+
30+
.title {
31+
color: var(--rp-c-text-2);
32+
line-height: 1;
33+
font-size: 0.75rem;
34+
margin-top: 4px;
35+
margin-bottom: 12px;
36+
}
37+
38+
.links {
39+
display: flex;
40+
gap: 8px;
41+
}
42+
43+
.link {
44+
display: inline-flex;
45+
align-items: center;
46+
justify-content: center;
47+
color: var(--rp-c-text-2);
48+
transition: color 0.2s;
49+
}
50+
51+
.link:hover {
52+
color: var(--rp-c-brand);
53+
}
54+
55+
.link svg {
56+
width: 16px;
57+
height: 16px;
58+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import styles from './BlogAvatar.module.css';
2+
3+
// cspell:disable
4+
const AUTHORS = {
5+
mikigo: {
6+
name: 'mikigo',
7+
title: 'autotest',
8+
github: 'https://github.com/mikigo',
9+
avatar: '/logo.png',
10+
x: '',
11+
},
12+
} as const;
13+
// cspell:enable
14+
15+
export function BlogAvatar({ author }: { author: string }) {
16+
const AUTHOR = AUTHORS[author as keyof typeof AUTHORS];
17+
if (!AUTHOR) {
18+
return null;
19+
}
20+
const { name, title, github, avatar, x } = AUTHOR || {};
21+
return (
22+
<div className={styles.avatarContainer}>
23+
<img src={avatar} alt={name} className={styles.avatar} />
24+
<div className={styles.info}>
25+
<div className={styles.name}>{name}</div>
26+
{title && <div className={styles.title}>{title}</div>}
27+
<div className={styles.links}>
28+
{github && (
29+
<a
30+
href={github}
31+
target="_blank"
32+
rel="noopener noreferrer"
33+
className={styles.link}
34+
aria-label={`${name}'s GitHub`}
35+
>
36+
<svg
37+
width="16"
38+
height="16"
39+
viewBox="0 0 24 24"
40+
fill="currentColor"
41+
>
42+
<path
43+
fill="currentColor"
44+
d="M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"
45+
/>
46+
</svg>
47+
</a>
48+
)}
49+
{x && (
50+
<a
51+
href={x}
52+
target="_blank"
53+
rel="noopener noreferrer"
54+
className={styles.link}
55+
aria-label={`${name}'s X profile`}
56+
>
57+
<svg
58+
width="16"
59+
height="16"
60+
viewBox="0 0 24 24"
61+
fill="currentColor"
62+
>
63+
<path
64+
fill="currentColor"
65+
d="M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584l-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"
66+
/>
67+
</svg>
68+
</a>
69+
)}
70+
</div>
71+
</div>
72+
</div>
73+
);
74+
}

docs/components/Blog/index.tsx

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import { useLang, usePages } from '@rspress/core/runtime';
2+
import {
3+
getCustomMDXComponent,
4+
renderInlineMarkdown,
5+
} from '@rspress/core/theme';
6+
import React from 'react';
7+
import { BlogAvatar } from './BlogAvatar';
8+
9+
export interface BlogItem {
10+
title?: string;
11+
description?: string;
12+
date?: Date;
13+
link?: string;
14+
authors?: string[];
15+
}
16+
17+
export interface BlogProps {
18+
posts: BlogItem[];
19+
}
20+
21+
export const useBlogPages = (): BlogItem[] => {
22+
const { pages } = usePages();
23+
const lang = useLang();
24+
25+
const blogPages = pages
26+
.filter(page => page.lang === lang)
27+
.filter(
28+
page =>
29+
page.routePath.includes('/blog/') && !page.routePath.endsWith('/blog/'),
30+
)
31+
.sort((a, b) => {
32+
const dateA = a.frontmatter?.date
33+
? new Date(a.frontmatter?.date as string)
34+
: new Date(0);
35+
const dateB = b.frontmatter?.date
36+
? new Date(b.frontmatter?.date as string)
37+
: new Date(0);
38+
return dateB.getTime() - dateA.getTime();
39+
});
40+
41+
return blogPages.map(
42+
({
43+
frontmatter: { description, date, authors, badge_text },
44+
routePath,
45+
title,
46+
}) => {
47+
const itemDate = date ? new Date(date as string) : undefined;
48+
// Extract filename from routePath, e.g. '/en/blog/lynx-3-5' -> 'lynx-3-5'
49+
const filename = routePath.split('/').pop();
50+
return {
51+
date: itemDate,
52+
description,
53+
link: routePath,
54+
title: title,
55+
authors: authors as string[] | undefined,
56+
badgeText: badge_text as string | undefined,
57+
filename,
58+
};
59+
},
60+
);
61+
};
62+
63+
export function BlogList() {
64+
const { h2: H2, p: P, a: A, hr: Hr } = getCustomMDXComponent();
65+
66+
const blogPages = useBlogPages();
67+
const lang = useLang();
68+
69+
return (
70+
<>
71+
{blogPages.map(({ date, description, link, title, authors }, index) => (
72+
<React.Fragment key={link || index}>
73+
{title && (
74+
<H2 id={link}>
75+
<A href={link}>{title}</A>
76+
</H2>
77+
)}
78+
{date && (
79+
<P>
80+
<em>
81+
{new Intl.DateTimeFormat(lang, {
82+
year: 'numeric',
83+
month: 'long',
84+
day: 'numeric',
85+
}).format(date)}
86+
</em>
87+
</P>
88+
)}
89+
{authors && (
90+
<>
91+
{authors.map(author => (
92+
<BlogAvatar author={author} key={author} />
93+
))}
94+
</>
95+
)}
96+
{description && <P {...renderInlineMarkdown(description)} />}
97+
{index < blogPages.length - 1 && <Hr />}
98+
</React.Fragment>
99+
))}
100+
</>
101+
);
102+
}

0 commit comments

Comments
 (0)