Skip to content

Commit

Permalink
Merge pull request #17 from project-trans/dev/remove-vuepress-bump-de…
Browse files Browse the repository at this point in the history
…ps-lint-all

refactor: remove vuepress, bump deps, lint all files
  • Loading branch information
yaoyao-moe authored Apr 11, 2024
2 parents 8b7d7c1 + f81bf8a commit 7fb5673
Show file tree
Hide file tree
Showing 25 changed files with 3,383 additions and 5,558 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
37 changes: 31 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
{
"cSpell.words": [
"iconify",
"katex",
"pangu",
"vuepress"
]
"cSpell.words": [
"antfu",
"attributify",
"iconify",
"katex",
"pangu",
"vuepress"
],
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,
// The following is optional.
// It's better to put under project setting `.vscode/settings.json`
// to avoid conflicts with working with different eslint configs
// that does not support all formats.
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml"
]
}
43 changes: 21 additions & 22 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { readFileSync, statSync } from 'node:fs'
import { join } from 'node:path'
import { defineConfig } from 'vitepress'
import nav from './nav'
import mdPangu from "markdown-it-pangu"
import mdPangu from 'markdown-it-pangu'
import katex from 'markdown-it-katex'
import footnote from 'markdown-it-footnote'
import nav from './nav'
import { sidebar } from './sidebar'
import { readFileSync, statSync } from 'node:fs'
import { join } from 'node:path'

const dir = 'docs'
const siteTitle = 'SOC-8'
Expand All @@ -17,17 +17,17 @@ export default defineConfig({
ssr: {
noExternal: [
'@nolebase/vitepress-plugin-enhanced-readabilities',
'@nolebase/vitepress-plugin-highlight-targeted-heading'
'@nolebase/vitepress-plugin-highlight-targeted-heading',
],
},
},
title: "SOC-8",
title: 'SOC-8',
base: '/SOC-8/',
markdown: {
config(md) {
md.use(mdPangu);
md.use(footnote);
md.use(katex);
md.use(mdPangu)
md.use(footnote)
md.use(katex)
},
},
dir,
Expand All @@ -42,7 +42,7 @@ export default defineConfig({
sidebar,

socialLinks: [
{ icon: 'github', link: 'https://github.com/project-trans/SOC-8' }
{ icon: 'github', link: 'https://github.com/project-trans/SOC-8' },
],

editLink: {
Expand Down Expand Up @@ -72,16 +72,16 @@ export default defineConfig({
'meta',
{
property: 'og:title',
content: siteTitle
}
content: siteTitle,
},
])

head.push([
'meta',
{
name: 'description',
content: '跨性别和多元性别人群健康照护指南第八版(SOC-8)'
}
content: '跨性别和多元性别人群健康照护指南第八版(SOC-8)',
},
])

return head
Expand Down Expand Up @@ -135,35 +135,34 @@ export default defineConfig({
// trim space
pageContent = pageContent.trim()
// if pageSourceFileContent is longer than 200 characters, add ellipsis
if (pageSourceFileContent.length > 100) {
if (pageSourceFileContent.length > 100)
pageContent += '...'
}

head.push([
'meta',
{ name: 'description', content: pageContent }
{ name: 'description', content: pageContent },
])

head.push([
'meta',
{ property: 'og:title', content: context.title }
{ property: 'og:title', content: context.title },
])

head.push([
'meta',
{ property: 'og:description', content: pageContent }
{ property: 'og:description', content: pageContent },
])

head.push([
'meta',
{ property: 'og:title', content: context.title }
{ property: 'og:title', content: context.title },
])

head.push([
'meta',
{ property: 'twitter:description', content: pageContent }
{ property: 'twitter:description', content: pageContent },
])

return head
}
},
})
5 changes: 3 additions & 2 deletions docs/.vitepress/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
declare module 'markdown-it-pangu' {
import { PluginSimple } from 'markdown-it'
import type { PluginSimple } from 'markdown-it'

const pangu: PluginSimple
export default pangu
}
}
10 changes: 5 additions & 5 deletions docs/.vitepress/nav.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { type DefaultTheme } from 'vitepress'
import type { DefaultTheme } from 'vitepress'

const nav = [
{
text: "简体中文翻译",
link: "/soc8cn/",
text: '简体中文翻译',
link: '/soc8cn/',
},
] satisfies DefaultTheme.Config['nav'];
export default nav;
] satisfies DefaultTheme.Config['nav']
export default nav
9 changes: 5 additions & 4 deletions docs/.vitepress/plugins/markdownTransform.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { relative, resolve } from 'node:path'
import type { Plugin } from 'vite'
import { resolve, relative } from 'path'

const ROOT = resolve(__dirname, '../../')

Expand All @@ -12,7 +12,7 @@ export function MarkdownTransform(): Plugin {
return null

id = relative(ROOT, id)
if (id == 'index.md')
if (id === 'index.md')
return null

code = pageHeaderTemplate(code)
Expand All @@ -22,11 +22,12 @@ export function MarkdownTransform(): Plugin {
}
}


const pageHeaderTemplate = (code: string) => code.replace(/(^---$(\s|\S)+^---$)/m, `$1
function pageHeaderTemplate(code: string) {
return code.replace(/(^---$(\s|\S)+^---$)/m, `$1
# {{ $frontmatter.title }}
<PageInfo />
`)
}
4 changes: 2 additions & 2 deletions docs/.vitepress/sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type DefaultTheme } from 'vitepress'
import type { DefaultTheme } from 'vitepress'
import { generateSidebar } from 'vitepress-sidebar'

export const sidebar = generateSidebar([
export const sidebar = generateSidebar([
// 大学指南
{
documentRootPath: '/docs',
Expand Down
19 changes: 7 additions & 12 deletions docs/.vitepress/theme/components/Containers.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<template>
<div
class="
suggestion-statement
border border-solid border-gray-800 dark:border-gray-400
my-14
pt-4 px-4
selector-[.suggestion-statement>h2]:(mt-0 pt-0 border-none)
selector-[.suggestion-statement_.header-anchor]:(top-0! left-5px!)
"
>
<slot />
</div>
<div
class="suggestion-statement selector-[.suggestion-statement>h2]:(mt-0 border-none pt-0) selector-[.suggestion-statement_.header-anchor]:(left-5px! top-0!)"
my-14 px-4 pt-4
border="gray-800 solid dark:gray-400"
>
<slot />
</div>
</template>
15 changes: 7 additions & 8 deletions docs/.vitepress/theme/components/PageInfo.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script setup lang="ts">
import { useData } from 'vitepress'
import { computed, onMounted, ref, watchEffect } from 'vue';
import { computed, onMounted, ref, watchEffect } from 'vue'
const { frontmatter, page, theme, lang } = useData()
const { frontmatter, page, theme, lang } = useData()
const date = computed(
() => new Date(frontmatter.value.lastUpdated ?? page.value.lastUpdated)
() => new Date(frontmatter.value.lastUpdated ?? page.value.lastUpdated),
)
const isoDatetime = computed(() => date.value.toISOString())
Expand All @@ -17,8 +17,8 @@ onMounted(() => {
theme.value.lastUpdated?.formatOptions?.forceLocale ? lang.value : undefined,
theme.value.lastUpdated?.formatOptions ?? {
dateStyle: 'short',
timeStyle: 'short'
}
timeStyle: 'short',
},
).format(date.value)
})
})
Expand All @@ -33,16 +33,15 @@ const authors = computed(() => {
return author
})
</script>

<template>
<div class="flex flex-wrap gap-4 mt-4 mb-10">
<div class="mb-10 mt-4 flex flex-wrap gap-4">
<div class="inline-flex items-center gap-1">
<span class="i-octicon:person" />
<span>作者:</span>
<span class="space-x-2">
<span v-for="author of authors">
<span v-for="author of authors" :key="author">
{{ author }}
</span>
</span>
Expand Down
15 changes: 7 additions & 8 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import './styles/styles.css'
import 'uno.css'

import {
NolebaseEnhancedReadabilitiesPlugin,
NolebaseEnhancedReadabilitiesMenu,
NolebaseEnhancedReadabilitiesPlugin,
NolebaseEnhancedReadabilitiesScreenMenu,
} from '@nolebase/vitepress-plugin-enhanced-readabilities'

Expand All @@ -19,12 +19,11 @@ import {
} from '@nolebase/vitepress-plugin-highlight-targeted-heading'

import {
NolebaseGitChangelogPlugin
NolebaseGitChangelogPlugin,
} from '@nolebase/vitepress-plugin-git-changelog/client'

import '@nolebase/vitepress-plugin-enhanced-readabilities/dist/style.css'
import '@nolebase/vitepress-plugin-highlight-targeted-heading/dist/style.css'
import '@nolebase/vitepress-plugin-git-changelog/client/style.css'

export default {
extends: DefaultTheme,
Expand All @@ -44,15 +43,15 @@ export default {
app.use(NolebaseEnhancedReadabilitiesPlugin, {
spotlight: {
defaultToggle: true,
}
},
})
app.use(NolebaseNolebaseHighlightTargetedHeadingPlugin)
app.use(NolebaseGitChangelogPlugin, {
locales: {
'zh-CN': {
lastEditedDateFnsLocaleName: 'zhCN'
}
}
lastEditedDateFnsLocaleName: 'zhCN',
},
},
})
}
},
} satisfies Theme
17 changes: 0 additions & 17 deletions docs/.vuepress/config.ts

This file was deleted.

5 changes: 0 additions & 5 deletions docs/.vuepress/env.d.ts

This file was deleted.

8 changes: 0 additions & 8 deletions docs/.vuepress/navbar.ts

This file was deleted.

Binary file removed docs/.vuepress/public/campus/CSU/CSU_BILL.jpg
Binary file not shown.
5 changes: 0 additions & 5 deletions docs/.vuepress/sidebar.ts

This file was deleted.

12 changes: 0 additions & 12 deletions docs/.vuepress/sidebarSorter.ts

This file was deleted.

Loading

0 comments on commit 7fb5673

Please sign in to comment.