import { Component, createSignal, onMount } from 'solid-js'; import { useLocation } from '@solidjs/router'; import { parseMarkdown } from './markdown'; // 导入组件以注册自定义元素 import './components'; const App: Component = () => { const location = useLocation(); const [content, setContent] = createSignal(''); onMount(async () => { // 根据路由加载对应的 markdown 文件 const path = location.pathname.slice(1) || 'index'; try { const response = await fetch(`/content/${path}.md`); if (response.ok) { const text = await response.text(); setContent(text); } else { setContent('# 欢迎使用 TTRPG Tools\n\n没有找到对应的内容文件。'); } } catch (error) { setContent('# 欢迎使用 TTRPG Tools\n\n这是一个 TTRPG 文档工具箱。\n\n## 功能\n\n- 使用 `:dice[2d6+d8]` 插入骰子组件\n- 使用 `:table[./data.csv]` 插入表格组件'); } }); return (

TTRPG Tools

); }; export default App;