mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Added AI Assisted development documentation. Updated Vuepress to the latest version. Added SEO and Sitemap plugins to Vuepress.
This commit is contained in:
parent
d25f2f40ec
commit
9613e0df51
11 changed files with 5381 additions and 2104 deletions
66
docs/.vuepress/client.ts
Normal file
66
docs/.vuepress/client.ts
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
import { computed, defineComponent, h } from 'vue'
|
||||
import {
|
||||
defineClientConfig,
|
||||
resolveRouteFullPath,
|
||||
useRoute,
|
||||
useRouter,
|
||||
} from 'vuepress/client'
|
||||
|
||||
const guardEvent = (event: MouseEvent): boolean => {
|
||||
if (event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) return false
|
||||
if (event.defaultPrevented) return false
|
||||
if (event.button !== undefined && event.button !== 0) return false
|
||||
|
||||
if (event.currentTarget instanceof Element) {
|
||||
const target = event.currentTarget.getAttribute('target')
|
||||
if (target?.match(/\b_blank\b/i)) return false
|
||||
}
|
||||
|
||||
event.preventDefault()
|
||||
return true
|
||||
}
|
||||
|
||||
const SafeRouteLink = defineComponent({
|
||||
name: 'RouteLink',
|
||||
props: {
|
||||
to: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
active: Boolean,
|
||||
activeClass: {
|
||||
type: String,
|
||||
default: 'route-link-active',
|
||||
},
|
||||
},
|
||||
setup(props, { slots }) {
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const path = computed(() =>
|
||||
props.to.startsWith('#') || props.to.startsWith('?')
|
||||
? props.to
|
||||
: `${__VUEPRESS_BASE__}${resolveRouteFullPath(props.to, route.path).substring(1)}`,
|
||||
)
|
||||
|
||||
return () =>
|
||||
h(
|
||||
'a',
|
||||
{
|
||||
class: ['route-link', { [props.activeClass]: props.active }],
|
||||
href: path.value,
|
||||
onClick: (event: MouseEvent) => {
|
||||
if (guardEvent(event)) {
|
||||
void router.push(props.to).catch(() => {})
|
||||
}
|
||||
},
|
||||
},
|
||||
slots.default?.() ?? [],
|
||||
)
|
||||
},
|
||||
})
|
||||
|
||||
export default defineClientConfig({
|
||||
enhance({ app }) {
|
||||
app.component('RouteLink', SafeRouteLink)
|
||||
},
|
||||
})
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
import process from 'node:process'
|
||||
|
||||
import { viteBundler } from '@vuepress/bundler-vite'
|
||||
import { webpackBundler } from '@vuepress/bundler-webpack'
|
||||
import { defineUserConfig } from '@vuepress/cli'
|
||||
import { markdownChartPlugin } from '@vuepress/plugin-markdown-chart'
|
||||
import { redirectPlugin } from '@vuepress/plugin-redirect'
|
||||
import { searchPlugin } from '@vuepress/plugin-search'
|
||||
import { shikiPlugin } from '@vuepress/plugin-shiki'
|
||||
import { defaultTheme } from '@vuepress/theme-default'
|
||||
import { getDirname, path } from '@vuepress/utils'
|
||||
import { searchPlugin } from "@vuepress/plugin-search";
|
||||
import { redirectPlugin } from "vuepress-plugin-redirect";
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
|
||||
import { headConfig } from './configs/head.js'
|
||||
import { mainConfig, defaultThemeConfig } from './configs/locales_config.js'
|
||||
|
||||
const __dirname = getDirname(import.meta.url)
|
||||
const isProd = process.env.NODE_ENV === 'production'
|
||||
|
||||
export default defineUserConfig({
|
||||
|
|
@ -29,8 +29,9 @@ export default defineUserConfig({
|
|||
|
||||
// configure default theme
|
||||
theme: defaultTheme({
|
||||
logo: "/images/MCC_logo.png",
|
||||
repo: "MCCTeam/Minecraft-Console-Client",
|
||||
hostname: 'https://mccteam.github.io',
|
||||
logo: '/images/MCC_logo.png',
|
||||
repo: 'MCCTeam/Minecraft-Console-Client',
|
||||
docsBranch: 'master',
|
||||
docsDir: 'docs',
|
||||
|
||||
|
|
@ -42,55 +43,58 @@ export default defineUserConfig({
|
|||
git: isProd,
|
||||
// use shiki plugin in production mode instead
|
||||
prismjs: !isProd,
|
||||
seo: isProd
|
||||
? {
|
||||
canonical: 'https://mccteam.github.io/',
|
||||
}
|
||||
: false,
|
||||
sitemap: isProd
|
||||
? {
|
||||
changefreq: 'weekly',
|
||||
}
|
||||
: false,
|
||||
},
|
||||
}),
|
||||
|
||||
// configure markdown
|
||||
markdown: {
|
||||
importCode: {
|
||||
handleImportPath: (str) =>
|
||||
str.replace(/^@vuepress/, path.resolve(__dirname, '../../ecosystem')),
|
||||
},
|
||||
},
|
||||
|
||||
// use plugins
|
||||
plugins: [
|
||||
redirectPlugin({
|
||||
hostname: "https://mccteam.github.io",
|
||||
hostname: 'https://mccteam.github.io',
|
||||
config: {
|
||||
"/r/entity.html": "https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Mapping/EntityType.cs",
|
||||
"/r/entity/index.html": "https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Mapping/EntityType.cs",
|
||||
'/r/entity.html': 'https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Mapping/EntityType.cs',
|
||||
'/r/entity/index.html': 'https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Mapping/EntityType.cs',
|
||||
|
||||
"/r/item.html": "https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Inventory/ItemType.cs",
|
||||
"/r/item/index.html": "https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Inventory/ItemType.cs",
|
||||
'/r/item.html': 'https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Inventory/ItemType.cs',
|
||||
'/r/item/index.html': 'https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Inventory/ItemType.cs',
|
||||
|
||||
"/r/block.html": "https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Mapping/Material.cs",
|
||||
"/r/block/index.html": "https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Mapping/Material.cs",
|
||||
'/r/block.html': 'https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Mapping/Material.cs',
|
||||
'/r/block/index.html': 'https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Mapping/Material.cs',
|
||||
|
||||
"/r/l-code.html": "https://github.com/MCCTeam/Minecraft-Console-Client/discussions/2239#discussion-4447461",
|
||||
"/r/l-code/index.html": "https://github.com/MCCTeam/Minecraft-Console-Client/discussions/2239#discussion-4447461",
|
||||
'/r/l-code.html': 'https://github.com/MCCTeam/Minecraft-Console-Client/discussions/2239#discussion-4447461',
|
||||
'/r/l-code/index.html': 'https://github.com/MCCTeam/Minecraft-Console-Client/discussions/2239#discussion-4447461',
|
||||
|
||||
"/r/dc-fmt.html": "https://www.writebots.com/discord-text-formatting/",
|
||||
"/r/dc-fmt/index.html": "https://www.writebots.com/discord-text-formatting/",
|
||||
'/r/dc-fmt.html': 'https://www.writebots.com/discord-text-formatting/',
|
||||
'/r/dc-fmt/index.html': 'https://www.writebots.com/discord-text-formatting/',
|
||||
|
||||
"/r/tg-fmt.html": "https://sendpulse.com/blog/telegram-text-formatting",
|
||||
"/r/tg-fmt/index.html": "https://sendpulse.com/blog/telegram-text-formatting",
|
||||
'/r/tg-fmt.html': 'https://sendpulse.com/blog/telegram-text-formatting',
|
||||
'/r/tg-fmt/index.html': 'https://sendpulse.com/blog/telegram-text-formatting',
|
||||
},
|
||||
}),
|
||||
|
||||
// only enable shiki plugin in production mode
|
||||
isProd ? shikiPlugin({ theme: 'dark-plus' }) : [],
|
||||
...(isProd ? [shikiPlugin({ theme: 'dark-plus' })] : []),
|
||||
|
||||
searchPlugin({
|
||||
maxSuggestions: 15,
|
||||
hotKeys: ["s", "/"],
|
||||
locales: {
|
||||
"/": {
|
||||
placeholder: "Search",
|
||||
},
|
||||
maxSuggestions: 15,
|
||||
hotKeys: ['s', '/'],
|
||||
locales: {
|
||||
'/': {
|
||||
placeholder: 'Search',
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
'vuepress-plugin-mermaidjs'
|
||||
markdownChartPlugin({
|
||||
mermaid: true,
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ export const defaultThemeConfig_en: DefaultThemeLocaleData = {
|
|||
"/guide/creating-text-script.md",
|
||||
"/guide/chat-bots.md",
|
||||
"/guide/creating-bots.md",
|
||||
"/guide/ai-assisted-development.md",
|
||||
"/guide/contibuting.md"
|
||||
],
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue