-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(search): 优化 tokenize 函数 * build: 升级到 node.js 18.16 & vitepress 1.0.0-rc.44 #36 * refactor(caption): 使用 md 插件实现图片小标题 * refactor(description): 使用 md-it 接口插入 description 组件 close #36 * fix(style): 只修改文章大图样式 * fix: align image alt text with caption text --------- Co-authored-by: eric.shady <darkercookies@gmail.com>
- Loading branch information
1 parent
394dcca
commit cf60a05
Showing
20 changed files
with
577 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/.vitepress/cache | ||
/.vitepress/dist | ||
/node_modules | ||
/temp | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
16 | ||
18.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import mdImageFigures from 'markdown-it-image-figures' | ||
import mdTaskCheckbox from 'markdown-it-task-checkbox' | ||
|
||
function appendImageFigures(md) { | ||
// usage: ![alt](https://link-to-image 'title'){.class} | ||
md.use(mdImageFigures, { | ||
figcaption: 'title', | ||
copyAttrs: '^class$' | ||
}) | ||
} | ||
|
||
function renderTaskCheckbox(md) { | ||
md.use(mdTaskCheckbox, { | ||
disabled: true, | ||
divWrap: false, | ||
divClass: 'checkbox', | ||
idPrefix: 'cbx_', | ||
ulClass: 'task-list', | ||
liClass: 'task-list-item' | ||
}) | ||
} | ||
|
||
function insertPostElements(md) { | ||
md.renderer.rules.heading_close = (tokens, idx, options, _env, self) => { | ||
let result = self.renderToken(tokens, idx, options) | ||
if (tokens[idx].markup === '#') { | ||
result += '\n\n<Description />\n\n' | ||
} | ||
return result | ||
} | ||
} | ||
|
||
export default function useMDItPlugins(md) { | ||
insertPostElements(md) | ||
appendImageFigures(md) | ||
renderTaskCheckbox(md) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<p | ||
v-if="frontmatter.description" | ||
:class="$style.description" | ||
>{{ frontmatter.description }} | ||
</p> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { useData } from "vitepress"; | ||
const { frontmatter } = useData(); | ||
</script> | ||
|
||
<style module scoped> | ||
.description { | ||
color: #8899a8; | ||
font-size: 20px; | ||
padding-bottom: 10px; | ||
} | ||
</style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
import DefaultTheme from 'vitepress/theme' | ||
import Description from './components/Description.vue' | ||
import './custom.css' | ||
|
||
export default DefaultTheme | ||
const { Layout } = DefaultTheme | ||
|
||
export default { | ||
extends: DefaultTheme, | ||
Layout, | ||
enhanceApp({ app }) { | ||
app.component('Description', Description) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ description: Duolingo | |
|
||
# 多邻国 | ||
|
||
<!--@include: ../../.vitepress/hack.md--> | ||
|
||
💡 建议看完全文之后再注册多邻国账号。 | ||
|
||
## 简介 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ description: New Concept English | |
|
||
# 新概念英语 | ||
|
||
<!--@include: ../../.vitepress/hack.md--> | ||
|
||
## 简介 🚧 | ||
|
||
## 教材构成 🚧 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ description: Spelling | |
|
||
# 拼写 | ||
|
||
<!--@include: ../../.vitepress/hack.md--> | ||
|
||
## 如何高效记拼写 🚧 | ||
|
||
## 番外:打字训练 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.