mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
style(webui): Web UI 文档页优化
This commit is contained in:
1 parent
d81c494ba2
commit
e82272e9fb
2 files changed
+68
-16
No files matched your search
+64
-2
@@ -191,10 +191,29 @@
|
||||
.doc-sheet-content h2 {
|
||||
color: var(--md-sys-color-primary);
|
||||
margin-top: 1.4em;
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
.doc-sheet-content h3 {
|
||||
color: var(--md-sys-color-secondary);
|
||||
.doc-sheet-content h3,
|
||||
.doc-sheet-content h4 {
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
margin-top: 1.2em;
|
||||
margin-bottom: 0.3em;
|
||||
}
|
||||
.doc-sheet-content p {
|
||||
margin: 0.6em 0;
|
||||
}
|
||||
.doc-sheet-content a {
|
||||
color: var(--md-sys-color-primary);
|
||||
text-decoration: underline;
|
||||
word-break: break-all;
|
||||
}
|
||||
.doc-sheet-content ul,
|
||||
.doc-sheet-content ol {
|
||||
padding-left: 1.4em;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
.doc-sheet-content li {
|
||||
margin: 0.25em 0;
|
||||
}
|
||||
.doc-sheet-content code {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
@@ -203,6 +222,49 @@
|
||||
font-family: 'Geist Mono', monospace;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
.doc-sheet-content pre {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
border-radius: 8px;
|
||||
padding: 12px 14px;
|
||||
overflow-x: auto;
|
||||
margin: 0.75em 0;
|
||||
}
|
||||
.doc-sheet-content pre code {
|
||||
background: none;
|
||||
padding: 0;
|
||||
border-radius: 0;
|
||||
font-size: 0.82em;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.doc-sheet-content blockquote {
|
||||
border-left: 3px solid var(--md-sys-color-primary-container);
|
||||
margin: 0.75em 0;
|
||||
padding: 0.2em 0.75em;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
background-color: rgba(var(--md-sys-color-primary-rgb), 0.06);
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
.doc-sheet-content hr {
|
||||
border: none;
|
||||
border-top: 1px solid var(--md-sys-color-outline-variant);
|
||||
margin: 1.2em 0;
|
||||
}
|
||||
.doc-sheet-content table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin: 0.75em 0;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
.doc-sheet-content th,
|
||||
.doc-sheet-content td {
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
padding: 6px 10px;
|
||||
text-align: left;
|
||||
}
|
||||
.doc-sheet-content th {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
Log Filter Tabs
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import MarkdownIt from 'markdown-it'
|
||||
import Button from '@/components/ui/Button.vue'
|
||||
import { BookOpen, ScrollText, StickyNote, X, Github } from 'lucide-vue-next'
|
||||
import { runCmd } from '../utils.js'
|
||||
@@ -11,6 +12,8 @@ const sheetTitle = ref('')
|
||||
const sheetContent = ref('')
|
||||
const sheetLoading = ref(false)
|
||||
|
||||
const md = new MarkdownIt({ html: false, linkify: true, typographer: true })
|
||||
|
||||
const moduleDocs = [
|
||||
{ title: 'README', file: `${MODULE_DIR}/README.md`, icon: BookOpen, md: true },
|
||||
{ title: 'README (EN)', file: `${MODULE_DIR}/README_en.md`, icon: BookOpen, md: true },
|
||||
@@ -18,19 +21,6 @@ const moduleDocs = [
|
||||
{ title: 'NOTE', file: `${MODULE_DIR}/NOTE.txt`, icon: StickyNote, md: false },
|
||||
]
|
||||
|
||||
function mdToHtml(text) {
|
||||
return text
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/^### (.+)$/gm, '<h3>$1</h3>')
|
||||
.replace(/^## (.+)$/gm, '<h2>$1</h2>')
|
||||
.replace(/^# (.+)$/gm, '<h1>$1</h1>')
|
||||
.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
|
||||
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
||||
.replace(/\n/g, '<br>')
|
||||
}
|
||||
|
||||
async function openModuleDoc(doc) {
|
||||
sheetTitle.value = doc.title
|
||||
sheetContent.value = ''
|
||||
@@ -40,7 +30,7 @@ async function openModuleDoc(doc) {
|
||||
const res = await runCmd(`cat "${doc.file}" 2>/dev/null`)
|
||||
if (res.errno !== 0 || !res.stdout.trim()) throw new Error('文件不存在或为空')
|
||||
sheetContent.value = doc.md
|
||||
? mdToHtml(res.stdout)
|
||||
? md.render(res.stdout)
|
||||
: res.stdout
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
|
||||
Reference in new issue
Block a user