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

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

|
||||
当然开源版固件功能有点少,又不想买烧录器自己折腾,所以把自己想要的功能写成网页:
|
||||
目前写了待办事项和倒计时,生成图片后上传
|
||||
|
||||
{% 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) {
|
||||
if (node.type === 'text' || node.type === 'inlineCode') return node.value ?? '';
|
||||
|
||||
@@ -259,6 +313,12 @@ function inlineToSource(node) {
|
||||
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('');
|
||||
return '';
|
||||
}
|
||||
@@ -267,12 +327,25 @@ function visit(node) {
|
||||
if (!node || typeof node !== 'object') return;
|
||||
|
||||
if (Array.isArray(node.children)) transformBlockTags(node.children);
|
||||
if (Array.isArray(node.children)) transformMixedTagParagraphs(node.children);
|
||||
|
||||
if (node.type === 'paragraph' && Array.isArray(node.children)) {
|
||||
const source = node.children.map(inlineToSource).join('');
|
||||
const transformed = transformText(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.value = transformed;
|
||||
delete node.children;
|
||||
|
||||
@@ -18,9 +18,6 @@ const { post } = Astro.props;
|
||||
const { Content } = await render(post.entry);
|
||||
const allPosts = await getAllPosts();
|
||||
const rawContent = post.body;
|
||||
const staleThreshold = new Date();
|
||||
staleThreshold.setFullYear(staleThreshold.getFullYear() - 1);
|
||||
const isOutdatedPost = post.date < staleThreshold;
|
||||
const textContent = rawContent
|
||||
.replace(/```[\s\S]*?```/g, '')
|
||||
.replace(/<[^>]+>/g, '')
|
||||
@@ -128,7 +125,7 @@ const relatedPosts = allPosts
|
||||
class="butterfly-note butterfly-note--warning article-outdated-note"
|
||||
aria-label="文章时效性提示"
|
||||
data-published-at={post.date.toISOString()}
|
||||
hidden={!isOutdatedPost}
|
||||
hidden
|
||||
>
|
||||
<i class="fa-solid fa-triangle-exclamation" aria-hidden="true"></i>
|
||||
<div class="butterfly-note__content">
|
||||
|
||||
+8
-3
@@ -1,3 +1,5 @@
|
||||
@import url("https://fontsapi.zeoseven.com/7/main/result.css");
|
||||
|
||||
:root {
|
||||
color-scheme: light;
|
||||
--bg: #f7f5ef;
|
||||
@@ -34,9 +36,8 @@
|
||||
body {
|
||||
margin: 0;
|
||||
color: var(--text);
|
||||
font-family:
|
||||
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
|
||||
"Microsoft YaHei", sans-serif;
|
||||
font-family: "Zhuque Fangsong (technical preview)";
|
||||
font-weight: normal;
|
||||
line-height: 1.75;
|
||||
background:
|
||||
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);
|
||||
}
|
||||
|
||||
.article-outdated-note[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.butterfly-note > i {
|
||||
margin-top: 0.28em;
|
||||
color: var(--butterfly-note-color, var(--accent));
|
||||
|
||||
Reference in New Issue
Block a user