fix: misc

This commit is contained in:
hypercross 2026-02-26 16:35:57 +08:00
parent 04dfa77eaf
commit e57e09ae05
4 changed files with 19 additions and 9 deletions

View File

@ -1,6 +1,6 @@
label,body,adj,noun,group label,body,adj,noun
🔥,**{{adj}}** 的{{noun}},高大,战士,基本 1,**{{adj}}** 的{{noun}},高大,战士
💧,{{adj}}的{{noun}},矮小,法师,基本 2,{{adj}}的{{noun}},矮小,法师
🌪️,{{adj}}的{{noun}},帅气,弓手,高级 3,{{adj}}的{{noun}},帅气,弓手
🌱,{{adj}}的{{noun}},丑陋,盗贼,高级 4,{{adj}}的{{noun}},丑陋,盗贼
⚡,{{adj}}的{{noun}},平庸,牧师,高级 5,{{adj}}的{{noun}},平庸,牧师

1 label body adj noun group
2 🔥 1 **{{adj}}** 的{{noun}} 高大 战士 基本
3 💧 2 {{adj}}的{{noun}} 矮小 法师 基本
4 🌪️ 3 {{adj}}的{{noun}} 帅气 弓手 高级
5 🌱 4 {{adj}}的{{noun}} 丑陋 盗贼 高级
6 5 {{adj}}的{{noun}} 平庸 牧师 高级

View File

@ -15,7 +15,7 @@ interface ContentIndex {
*/ */
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename); const __dirname = dirname(__filename);
const distDir = resolve(__dirname, "..", "..", "web"); const distDir = resolve(__dirname, "..", "..", "..", "dist", "web");
/** /**
* MIME * MIME

View File

@ -2,6 +2,15 @@ import { Component, createMemo, createSignal, Show } from "solid-js";
import { type FileNode, type TocNode } from "../data-loader"; import { type FileNode, type TocNode } from "../data-loader";
import { useNavigate } from "@solidjs/router"; import { useNavigate } from "@solidjs/router";
/**
*
*/
function isPathInDir(currentPath: string, dirPath: string): boolean {
// 确保 dirPath 以 / 结尾,用于前缀匹配
const dirPathPrefix = dirPath.endsWith('/') ? dirPath : dirPath + '/';
return currentPath.startsWith(dirPathPrefix);
}
/** /**
* *
*/ */
@ -13,9 +22,10 @@ export const FileTreeNode: Component<{
onClose: () => void; onClose: () => void;
}> = (props) => { }> = (props) => {
const navigate = useNavigate(); const navigate = useNavigate();
const [isExpanded, setIsExpanded] = createSignal(true);
const isDir = !!props.node.children; const isDir = !!props.node.children;
const isActive = createMemo(() => props.currentPath === props.node.path); const isActive = createMemo(() => props.currentPath === props.node.path);
// 默认收起,除非当前文件在该文件夹内
const [isExpanded, setIsExpanded] = createSignal(isDir && isPathInDir(props.currentPath, props.node.path));
const handleClick = () => { const handleClick = () => {
if (isDir) { if (isDir) {

View File

@ -5,7 +5,7 @@ import { createDirectives } from 'marked-directive';
const marked = new Marked().use(createDirectives()); const marked = new Marked().use(createDirectives());
export function parseMarkdown(content: string): string { export function parseMarkdown(content: string): string {
return marked.parse(content) as string; return marked.parse(content.trimStart()) as string;
} }
export { marked }; export { marked };