Skip to content

Commit

Permalink
feat: convert absolute link to relative link and fix types error
Browse files Browse the repository at this point in the history
  • Loading branch information
northword committed Jun 30, 2024
1 parent ad223c2 commit c0c52e2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .vitepress/config/markdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { mark } from '@mdit/plugin-mark'
import { markdown as _markdown } from '../../src/wiki/.vitepress/config/markdown'

export const markdown: UserConfig['markdown'] = {
..._markdown,
..._markdown as Omit<UserConfig['markdown'], 'config'>,
config: (md) => {
md.use(footnote)
md.use(mark)
Expand Down
36 changes: 30 additions & 6 deletions .vitepress/plugins/markdownTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export function MarkdownTransform(): Plugin {
name: 'zotero-chinese-md-transform',
enforce: 'pre',
async transform(code, id) {
// id 为文件磁盘绝对路径

if (!id.match(/\.md\b/))
return null

Expand All @@ -13,16 +15,38 @@ export function MarkdownTransform(): Plugin {
/https?:\/\/zotero-chinese\.com\/user-guide\//g,
'/user-guide/',
)
code = code.replaceAll(
/https?:\/\/zotero-chinese\.com\/plugins\/?/g,
'/plugins/',
)
code = code.replaceAll(
/https?:\/\/zotero-chinese\.com\/styles\/?/g,
'/styles/',
)
code = code.replaceAll(
/https?:\/\/zotero-chinese\.com\//g,
'/',
)

// wiki 部分贡献指南
if (id.match('/wiki/')) {
// code = [
// code,
// '<DocInfoCord />',
// ].join('\n\n')
}

// CSL 样式部分
if (id.match(/styles\/detail\/.*\.md/)) {
// 为详情页增加 md 前言
code = `---
sidebar: false
comments: false
editLink: false
---
${code}`
code = [
'---',
'sidebar: false',
'comments: false',
'editLink: false',
'---',
code,
].join('\n')

// CSL 详情页的头部块
code = code.replace(
Expand Down
2 changes: 1 addition & 1 deletion src/wiki
Submodule wiki updated 40 files
+9 −1 .github/ISSUE_TEMPLATE/config.yml
+5 −1 .vitepress/config/sidebar.ts
+ assets/images/image-connector-safari-button.jpg
+ assets/images/image-connector-safari-button2.jpg
+ assets/images/image-item-in-zotero.png
+ assets/images/image-uninstall-connector-chrome.jpg
+ assets/images/image-uninstall-connector-chrome2.jpg
+ assets/images/image-uninstall-connector-safari.jpg
+ assets/images/image-uninstall-connector-safari1.jpg
+ assets/images/image-uninstall-connector-safari2.jpg
+ assets/images/image-uninstall-connector-safari3.jpg
+ assets/images/image-update-official-translators.jpg
+ assets/images/image-update-translator-ResetTranslators.jpg
+ assets/images/image-update-translator-chrome-1.jpg
+ assets/images/image-update-translator-safari-1.jpg
+ assets/images/image-update-translator-safari-2.jpg
+ assets/images/image-update-translator-如何确保更新成功.jpg
+ assets/images/image-update-unofficial-translators.jpg
+2 −2 plugin-dev-guide/development/debug.md
+4 −4 plugin-dev-guide/reference/manifest.md
+1 −1 user-guide/add-items.md
+10 −69 user-guide/backup.md
+39 −2 user-guide/citation-styles.md
+2 −2 user-guide/edit-items.md
+2 −2 user-guide/faqs/plugins.md
+150 −50 user-guide/faqs/update-translators.md
+5 −5 user-guide/faqs/word-addon.md
+8 −4 user-guide/index.md
+4 −4 user-guide/install.md
+1 −1 user-guide/organize-library.md
+5 −5 user-guide/plugins/about-plugin.md
+2 −2 user-guide/plugins/better-notes.md
+12 −1 user-guide/plugins/jasminum.md
+1 −1 user-guide/plugins/linter.md
+1 −1 user-guide/plugins/style.md
+80 −0 user-guide/plugins/tara.md
+1 −1 user-guide/plugins/translate.md
+1 −1 user-guide/plugins/zotero-gpt.md
+2 −2 user-guide/plugins/zotero-scihub.md
+3 −0 user-guide/sync.md

0 comments on commit c0c52e2

Please sign in to comment.