@@ -17,6 +17,7 @@ date: 2026-04-02 04:52:16
|
|||||||
|
|
||||||
# 安装Visual Studio
|
# 安装Visual Studio
|
||||||
现在我们先来安装`Visual Studio`:[visual studio](https://visualstudio.microsoft.com/zh-hans/vs/),下载后安装即可|在安装时选择“使用C++的桌面开发”,这样安装时就会安装C++的编译器了。
|
现在我们先来安装`Visual Studio`:[visual studio](https://visualstudio.microsoft.com/zh-hans/vs/),下载后安装即可|在安装时选择“使用C++的桌面开发”,这样安装时就会安装C++的编译器了。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
# 安装 Cmake
|
# 安装 Cmake
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ tags:
|
|||||||

|

|
||||||
当然开源版固件功能有点少,又不想买烧录器自己折腾,所以把自己想要的功能写成网页:
|
当然开源版固件功能有点少,又不想买烧录器自己折腾,所以把自己想要的功能写成网页:
|
||||||
目前写了待办事项和倒计时,生成图片后上传
|
目前写了待办事项和倒计时,生成图片后上传
|
||||||
|
|
||||||
{% link 生成图,tu,https://letters.biss.click/gen/ %}
|
{% link 生成图,tu,https://letters.biss.click/gen/ %}
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
@@ -251,6 +251,60 @@ function transformBlockTags(children) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function splitMixedTagParagraph(node) {
|
||||||
|
if (node?.type !== 'paragraph' || !Array.isArray(node.children)) return [node];
|
||||||
|
if (!node.children.some((child) => child.type === 'image')) return [node];
|
||||||
|
|
||||||
|
const source = node.children.map(inlineToSource).join('');
|
||||||
|
if (!hexoTagPattern.test(source)) return [node];
|
||||||
|
hexoTagPattern.lastIndex = 0;
|
||||||
|
|
||||||
|
const result = [];
|
||||||
|
let currentChildren = [];
|
||||||
|
|
||||||
|
const flushParagraph = () => {
|
||||||
|
if (currentChildren.length === 0) return;
|
||||||
|
result.push({ type: 'paragraph', children: currentChildren });
|
||||||
|
currentChildren = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const child of node.children) {
|
||||||
|
if (child.type !== 'text' || typeof child.value !== 'string') {
|
||||||
|
currentChildren.push(child);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pattern = new RegExp(hexoTagPattern);
|
||||||
|
let lastIndex = 0;
|
||||||
|
let match;
|
||||||
|
|
||||||
|
while ((match = pattern.exec(child.value))) {
|
||||||
|
const before = child.value.slice(lastIndex, match.index);
|
||||||
|
if (before) currentChildren.push({ type: 'text', value: before });
|
||||||
|
|
||||||
|
flushParagraph();
|
||||||
|
result.push({ type: 'html', value: renderTag(match[1], match[2]) });
|
||||||
|
lastIndex = pattern.lastIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
const after = child.value.slice(lastIndex);
|
||||||
|
if (after) currentChildren.push({ type: 'text', value: after });
|
||||||
|
}
|
||||||
|
|
||||||
|
flushParagraph();
|
||||||
|
return result.length > 0 ? result : [node];
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformMixedTagParagraphs(children) {
|
||||||
|
for (let index = 0; index < children.length; index += 1) {
|
||||||
|
const replacement = splitMixedTagParagraph(children[index]);
|
||||||
|
if (replacement.length === 1 && replacement[0] === children[index]) continue;
|
||||||
|
|
||||||
|
children.splice(index, 1, ...replacement);
|
||||||
|
index += replacement.length - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function inlineToSource(node) {
|
function inlineToSource(node) {
|
||||||
if (node.type === 'text' || node.type === 'inlineCode') return node.value ?? '';
|
if (node.type === 'text' || node.type === 'inlineCode') return node.value ?? '';
|
||||||
|
|
||||||
@@ -259,6 +313,12 @@ function inlineToSource(node) {
|
|||||||
return `[${text}](${node.url})`;
|
return `[${text}](${node.url})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node.type === 'image') {
|
||||||
|
const alt = node.alt ?? '';
|
||||||
|
const title = node.title ? ` "${node.title}"` : '';
|
||||||
|
return ``;
|
||||||
|
}
|
||||||
|
|
||||||
if (Array.isArray(node.children)) return node.children.map(inlineToSource).join('');
|
if (Array.isArray(node.children)) return node.children.map(inlineToSource).join('');
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -267,12 +327,25 @@ function visit(node) {
|
|||||||
if (!node || typeof node !== 'object') return;
|
if (!node || typeof node !== 'object') return;
|
||||||
|
|
||||||
if (Array.isArray(node.children)) transformBlockTags(node.children);
|
if (Array.isArray(node.children)) transformBlockTags(node.children);
|
||||||
|
if (Array.isArray(node.children)) transformMixedTagParagraphs(node.children);
|
||||||
|
|
||||||
if (node.type === 'paragraph' && Array.isArray(node.children)) {
|
if (node.type === 'paragraph' && Array.isArray(node.children)) {
|
||||||
const source = node.children.map(inlineToSource).join('');
|
const source = node.children.map(inlineToSource).join('');
|
||||||
const transformed = transformText(source);
|
const transformed = transformText(source);
|
||||||
|
|
||||||
if (transformed !== source) {
|
if (transformed !== source) {
|
||||||
|
if (node.children.some((child) => child.type === 'image')) {
|
||||||
|
node.children = node.children.map((child) => {
|
||||||
|
if (child.type !== 'text' || typeof child.value !== 'string') return child;
|
||||||
|
|
||||||
|
const childTransformed = transformText(child.value);
|
||||||
|
if (childTransformed === child.value) return child;
|
||||||
|
|
||||||
|
return { type: 'html', value: childTransformed };
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
node.type = 'html';
|
node.type = 'html';
|
||||||
node.value = transformed;
|
node.value = transformed;
|
||||||
delete node.children;
|
delete node.children;
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ const { post } = Astro.props;
|
|||||||
const { Content } = await render(post.entry);
|
const { Content } = await render(post.entry);
|
||||||
const allPosts = await getAllPosts();
|
const allPosts = await getAllPosts();
|
||||||
const rawContent = post.body;
|
const rawContent = post.body;
|
||||||
const staleThreshold = new Date();
|
|
||||||
staleThreshold.setFullYear(staleThreshold.getFullYear() - 1);
|
|
||||||
const isOutdatedPost = post.date < staleThreshold;
|
|
||||||
const textContent = rawContent
|
const textContent = rawContent
|
||||||
.replace(/```[\s\S]*?```/g, '')
|
.replace(/```[\s\S]*?```/g, '')
|
||||||
.replace(/<[^>]+>/g, '')
|
.replace(/<[^>]+>/g, '')
|
||||||
@@ -128,7 +125,7 @@ const relatedPosts = allPosts
|
|||||||
class="butterfly-note butterfly-note--warning article-outdated-note"
|
class="butterfly-note butterfly-note--warning article-outdated-note"
|
||||||
aria-label="文章时效性提示"
|
aria-label="文章时效性提示"
|
||||||
data-published-at={post.date.toISOString()}
|
data-published-at={post.date.toISOString()}
|
||||||
hidden={!isOutdatedPost}
|
hidden
|
||||||
>
|
>
|
||||||
<i class="fa-solid fa-triangle-exclamation" aria-hidden="true"></i>
|
<i class="fa-solid fa-triangle-exclamation" aria-hidden="true"></i>
|
||||||
<div class="butterfly-note__content">
|
<div class="butterfly-note__content">
|
||||||
|
|||||||
+8
-3
@@ -1,3 +1,5 @@
|
|||||||
|
@import url("https://fontsapi.zeoseven.com/7/main/result.css");
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
color-scheme: light;
|
color-scheme: light;
|
||||||
--bg: #f7f5ef;
|
--bg: #f7f5ef;
|
||||||
@@ -34,9 +36,8 @@
|
|||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
font-family:
|
font-family: "Zhuque Fangsong (technical preview)";
|
||||||
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
|
font-weight: normal;
|
||||||
"Microsoft YaHei", sans-serif;
|
|
||||||
line-height: 1.75;
|
line-height: 1.75;
|
||||||
background:
|
background:
|
||||||
linear-gradient(rgba(247, 245, 239, 0.86), rgba(247, 245, 239, 0.95)),
|
linear-gradient(rgba(247, 245, 239, 0.86), rgba(247, 245, 239, 0.95)),
|
||||||
@@ -1700,6 +1701,10 @@ time {
|
|||||||
background: rgba(236, 253, 245, 0.58);
|
background: rgba(236, 253, 245, 0.58);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.article-outdated-note[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.butterfly-note > i {
|
.butterfly-note > i {
|
||||||
margin-top: 0.28em;
|
margin-top: 0.28em;
|
||||||
color: var(--butterfly-note-color, var(--accent));
|
color: var(--butterfly-note-color, var(--accent));
|
||||||
|
|||||||
Reference in New Issue
Block a user