รับโอน

This commit is contained in:
setthawutttty 2024-11-19 18:01:06 +07:00
parent f380037c5a
commit 8974d35904
165 changed files with 652 additions and 174 deletions

View file

@ -32,9 +32,11 @@ const { toc } = storeToRefs(manual);
const text = ref("");
const parsed = ref<Token[]>([]);
const chapter = ref(0);
const chapter2 = ref(0);
const found = ref(false);
const active = ref("");
const subChapter = ref<string>("");
const subChapter2 = ref<string>("");
function onScroll() {
let current = "";
@ -94,7 +96,7 @@ onMounted(async () => {
if (typeof route.params.name === "string") {
const res = await fetch(`/documents/${route.params.name}.md`);
if (res && res.ok) {
const pattern = /chapter-(\d+)(?:-(\d+))?/;
const pattern = /chapter-(\d+)(?:-(\d+))?(?:-(\d+))?/;
const match = pattern.exec(route.params.name);
console.log("🚀 ~ onMounted ~ match:", match)
@ -104,8 +106,14 @@ onMounted(async () => {
found.value = true;
const mainChapter = +match[1] - 1;
subChapter.value = match[2] ? `.${match[2]}`:' ';
const mainChapter2 = +match[2] - 1;
subChapter.value = match[2] ? `".${match[2]}"`:'""';
subChapter2.value = match[3] ? `".${match[3]}"`:'""';
chapter.value = mainChapter;
console.log("🚀 ~ onMounted ~ chapter.value:", chapter.value)
chapter2.value = mainChapter2;
console.log("🚀 ~ onMounted ~ chapter2.value = mainChapter2:", chapter2.value = mainChapter2)
parsed.value = md.parse(text.value, {});
}
@ -195,6 +203,8 @@ onUnmounted(() => {
}
.markdown {
--sub-chapter: v-bind(subChapter);
--sub-chapter2: v-bind(subChapter2);
counter-set: h1 v-bind(chapter);
counter-reset: h1;
}
@ -217,22 +227,22 @@ onUnmounted(() => {
.markdown :deep(h1:before) {
counter-increment: h1;
content: counter(h1) ". " ;
content: counter(h1) var(--sub-chapter) var(--sub-chapter2) ". ";
}
.markdown :deep(h2:before) {
counter-increment: h2;
content: counter(h1) "." counter(h2) " ";
content: counter(h1) var(--sub-chapter) var(--sub-chapter2) "." counter(h2) " ";
}
.markdown :deep(h3:before) {
counter-increment: h3;
content: counter(h1) "." counter(h2) "." counter(h3) " ";
content: counter(h1) var(--sub-chapter) var(--sub-chapter2) "." counter(h2) "." counter(h3) " ";
}
.markdown :deep(h4:before) {
counter-increment: h4;
content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) " ";
content: counter(h1) var(--sub-chapter) var(--sub-chapter2) "." counter(h2) "." counter(h3) "." counter(h4) " ";
}
.markdown :deep(blockquote) {