create-vuepress-theme-hope 2.0.0-beta.8 → 2.0.0-beta.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{readme.md → README.md} +0 -0
- package/lib/index.js +2 -0
- package/package.json +21 -12
- package/template/en-US/.vuepress/config.ts +8 -24
- package/template/en-US/.vuepress/navbar.ts +2 -2
- package/template/en-US/.vuepress/sidebar.ts +9 -10
- package/template/en-US/.vuepress/{themeConfig.ts → theme.ts} +29 -6
- package/template/en-US/README.md +1 -1
- package/template/en-US/guide/README.md +5 -3
- package/template/en-US/guide/disable.md +4 -3
- package/template/en-US/guide/encrypt.md +1 -1
- package/template/en-US/guide/markdown.md +182 -39
- package/template/en-US/guide/page.md +26 -18
- package/template/en-US/home.md +7 -7
- package/template/en-US/slide.md +1 -1
- package/template/i18n/.vuepress/config.ts +4 -16
- package/template/i18n/.vuepress/navbar/en.ts +2 -2
- package/template/i18n/.vuepress/navbar/zh.ts +2 -2
- package/template/i18n/.vuepress/sidebar/en.ts +3 -4
- package/template/i18n/.vuepress/sidebar/zh.ts +4 -3
- package/template/i18n/.vuepress/{themeConfig.ts → theme.ts} +29 -15
- package/template/i18n/README.md +1 -1
- package/template/i18n/guide/README.md +5 -3
- package/template/i18n/guide/disable.md +4 -3
- package/template/i18n/guide/encrypt.md +1 -1
- package/template/i18n/guide/markdown.md +184 -39
- package/template/i18n/guide/page.md +26 -18
- package/template/i18n/home.md +7 -7
- package/template/i18n/slide.md +1 -1
- package/template/i18n/zh/README.md +1 -1
- package/template/i18n/zh/guide/README.md +5 -3
- package/template/i18n/zh/guide/disable.md +4 -3
- package/template/i18n/zh/guide/markdown.md +162 -35
- package/template/i18n/zh/guide/page.md +21 -13
- package/template/i18n/zh/home.md +4 -4
- package/template/zh-CN/.vuepress/config.ts +8 -24
- package/template/zh-CN/.vuepress/navbar.ts +2 -2
- package/template/zh-CN/.vuepress/sidebar.ts +9 -8
- package/template/zh-CN/.vuepress/{themeConfig.ts → theme.ts} +28 -10
- package/template/zh-CN/README.md +1 -1
- package/template/zh-CN/guide/README.md +5 -3
- package/template/zh-CN/guide/disable.md +4 -3
- package/template/zh-CN/guide/markdown.md +162 -35
- package/template/zh-CN/guide/page.md +21 -13
- package/template/zh-CN/home.md +6 -6
- package/CHANGELOG.md +0 -130
- package/lib/node/index.d.ts +0 -1
- package/lib/node/index.js +0 -3
- package/lib/node/index.js.map +0 -1
- package/rollup.config.js +0 -14
- package/src/node/checkVersion.ts +0 -31
- package/src/node/copy.ts +0 -45
- package/src/node/deepAssign.ts +0 -42
- package/src/node/hasYarn.ts +0 -10
- package/src/node/i18n.ts +0 -89
- package/src/node/index.ts +0 -174
- package/src/node/registry.ts +0 -31
- package/tsconfig.build.json +0 -10
- package/tsconfig.json +0 -8
package/{readme.md → README.md}
RENAMED
|
File without changes
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{cac as e}from"cac";import{execaCommandSync as s,execaCommand as n}from"execa";import t from"inquirer";import{existsSync as r,readFileSync as o,writeFileSync as a,readdirSync as i,mkdirSync as c,statSync as p,createReadStream as l,createWriteStream as u}from"fs";import{resolve as m,dirname as d,join as g}from"path";import{get as h}from"https";import{fileURLToPath as v}from"url";const f=(()=>{try{return 0===s("pnpm --version",{stdio:"ignore"}).exitCode}catch(e){return!1}})()?"pnpm":(()=>{try{return 0===s("yarn --version",{stdio:"ignore"}).exitCode}catch(e){return!1}})()?"yarn":"npm",y={"简体中文":{getVersion:"获取依赖的最新版本...",createPackage:"生成 package.json...",updatePackage:"更新 package.json...",template:"生成模板...",wait:"这可能需要数分钟,请耐心等待.\n我们无法正确输出子进程的进度条,所以进程可能会看似未响应",install:"安装依赖...",success:"模板已成功生成!",devServerAsk:"是否想要现在启动 Demo 查看?",devServer:"启动开发服务器...\n启动成功后,请在浏览器输入给出的开发服务器地址(默认为 'localhost:8080')",hint:`提示: 请使用 "${f} run docs:dev" 命令启动开发服务器`,nameMessage:"设置应用名称",nameError:"应用名称应只包含小写字母、数字和连接线 (-)",versionMessage:"设置应用版本号",versionError:"此版本无效,版本号应为 'x.x.x'",dirError:'"[dir]" 的方括号表示此处为一个参数,你应该替换为自己想使用的文件夹名称,如 "src", "docs" 等!\n例如: "npm init vuepress-theme-hope@next docs"',descriptionMessage:"设置应用描述",licenseMessage:"设置协议",i18nMessage:"项目需要用到多语言么?",gitMessage:"是否初始化 Git 仓库?",workflowMessage:"是否需要一个自动部署文档到 GitHub Pages 的工作流?"},"english (US)":{getVersion:"Getting lastest version of deps...",createPackage:"Generating package.json...",updatePackage:"Updating package.json...",template:"Generating Template...",wait:"This may take a few minutes, please be patient.\nWe can not correctly output progress bar from child process, so the process may look stuck.",install:"Installing Deps...",success:"Successful Generated!",devServerAsk:"Would you like to preview template now?",devServer:"Staring dev server...\nAfter the dev server starts running, please visit the given server link ('localhost:8080' by default)",hint:`Hint: You should execute "${f} run docs:dev" to start dev server.`,nameMessage:"Your project name",nameError:"package name should only contain lowercase characters, numbers and dash",versionMessage:"Your project version",versionError:"This version is not a valid one. Version should be like 'x.x.x'",dirError:'The brackets in "[dir]" means it is an argument, you should replace it with folder name you want to use! E.g.: "src", "docs"\nFor example: "npm init vuepress-theme-hope@next docs"',descriptionMessage:"Your project description",licenseMessage:"Your project lincense",i18nMessage:"Does the project need multiple languages?",gitMessage:"Initialize a git repository?",workflowMessage:"Do you need a GitHub workflow to deploy docs on GitHub pages?"}},w=async e=>{for(let s=1;s<=3;s++){const n=await new Promise(((s,n)=>{h(`${"npm"===f?"https://registry.npmjs.org":"https://registry.yarnpkg.com"}/-/package/${e}/dist-tags`,(e=>{if(200===e.statusCode){let n="";e.on("data",(e=>n+=e)),e.on("end",(()=>{s(JSON.parse(n).next)}))}else n()})).on("error",(()=>{n()}))})).catch((()=>{console.log(`Get ${e} version failed, [${s}/3]`)}));if(n)return n}throw new Error(`Get ${e} version failed!`)},$=(e,...s)=>{if(0===s.length)return e;const n=s.shift()||{};return Object.keys(n).forEach((s=>{"object"!=typeof e[s]||Array.isArray(e[s])||"object"!=typeof n[s]||Array.isArray(n[s])?"object"==typeof n[s]?Array.isArray(n[s])?e[s]=[...n[s]]:e[s]={...n[s]}:e[s]=n[s]:$(e[s],n[s])})),$(e,...s)},k=async(e,s)=>{const n=m(process.cwd(),"package.json"),i=(e=>({"docs:build":`vuepress build ${e}`,"docs:clean-dev":`vuepress dev ${e} --clean-cache`,"docs:dev":`vuepress dev ${e}`}))(e),c=await(async e=>Object.fromEntries(await Promise.all(e.map((async e=>[e,`^${await w(e)}`])))))(["@vuepress/client","vue","vuepress","vuepress-theme-hope"]);if(r(n)){console.log(s.updatePackage);const e=JSON.parse(o(n,{encoding:"utf-8"}));$(e,{scripts:i,devDependencies:c}),a(n,`${JSON.stringify(e,null,2)}\n`,{encoding:"utf-8"})}else{console.log(s.createPackage);const e={...await t.prompt([{name:"name",type:"input",message:s.nameMessage,default:"vuepress-theme-hope-template",validate:e=>!!/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/u.exec(e)||s.nameError},{name:"version",type:"input",message:s.versionMessage,default:"2.0.0",validate:e=>!!/^[0-9]+\.[0-9]+\.(?:[0=9]+|[0-9]+-[a-z]+\.[0-9])$/u.exec(e)||s.versionError},{name:"description",type:"input",message:s.descriptionMessage,default:"A project of vuepress-theme-hope"},{name:"license",type:"input",message:s.licenseMessage,default:"MIT"}]),scripts:i,devDependencies:c};a(n,`${JSON.stringify(e,null,2)}\n`,{encoding:"utf-8"})}},b=async e=>{const n=s(`${f} config get registry`).stdout;if("简体中文"===e){const{registry:e}=await t.prompt([{name:"registry",type:"list",message:"选择你想使用的源",choices:["国内镜像源","当前源"]}]);return"国内镜像源"===e?"https://registry.npmmirror.com/":n}return n},x=e=>{try{i(e)}catch(s){c(e,{recursive:!0})}},M=(e,s)=>{const n=d(s);x(n);const t=l(e),r=u(s);t.pipe(r)},j=(e,s)=>{x(s);i(e,{withFileTypes:!0}).forEach((n=>{n.isFile()?M(`${e}/${n.name}`,`${s}/${n.name}`):n.isDirectory()&&j(`${e}/${n.name}`,`${s}/${n.name}`)}))},S=v(import.meta.url),D=d(S),E=e=>{const s=m(process.cwd(),".gitignore"),n=r(s)?o(s,{encoding:"utf-8"}):"";a(s,`${n}${(e=>`\nnode_modules/\n${e}/.vuepress/.cache/\n${e}/.vuepress/.temp/\n${e}/.vuepress/dist/\n`)(e)}`,{encoding:"utf-8"})},G=async(e,n,r)=>{const{i18n:o,workflow:i}=await t.prompt([{name:"i18n",type:"confirm",message:r.i18nMessage,default:!1},{name:"workflow",type:"confirm",message:r.workflowMessage,default:!0}]);console.log(r.template);var c,l;if(c=m(D,"../template",o?"i18n":"简体中文"===n?"zh-CN":"en-US"),l=m(process.cwd(),e),p(c).isDirectory()?j(c,l):p(c).isFile()&&M(c,l),i){const s=m(process.cwd(),".github/workflows");x(s),a(m(s,"deploy-docs.yml"),((e,s)=>`\nname: ${"简体中文"===s?"部署文档":"Deploy Docs"}\n\non:\n push:\n branches:\n # ${"简体中文"===s?"确保这是你正在使用的分支名称":"make sure this is the branch you are using"}\n - main\n\njobs:\n deploy-gh-pages:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n uses: actions/checkout@v3\n with:\n fetch-depth: 0\n # ${"简体中文"===s?"如果你文档需要 Git 子模块,取消注释下一行":"if your docs needs submodules, uncomment the following line"}\n # submodules: true\n\n${"pnpm"===f?`\n - name: ${"简体中文"===s?"安装 pnpm":"Install pnpm"}\n uses: pnpm/action-setup@v2\n with:\n version: 7\n run_install: true\n`:""}\n\n - name: ${"简体中文"===s?"设置 Node.js":"Setup Node.js"}\n uses: actions/setup-node@v3\n with:\n node-version: 16\n cache: ${f}\n\n - name: ${"简体中文"===s?"安装依赖":"Install Deps"}\n run: ${"npm"===f?"npm install":`${f} install --frozen-lockfile`}\n\n - name: ${"简体中文"===s?"构建文档":"Build Docs"}\n env:\n NODE_OPTIONS: --max_old_space_size=4096\n run: ${f} run docs:build\n\n - name: ${"简体中文"===s?"部署文档":"Deploy Docs"}\n uses: JamesIves/github-pages-deploy-action@v4\n with:\n # ${"简体中文"===s?"这是文档部署到的分支名称":"This is the branch where the docs are deployed to"}\n branch: gh-pages\n folder: ${g(e,".vuepress/dist").replace(/\\/g,"/")}\n\n`)(e,n),{encoding:"utf-8"})}if((()=>{try{return s("git log"),!0}catch{return!1}})())E(e);else if((()=>{try{return s("git log"),!0}catch{return!1}})()){const{git:n}=await t.prompt([{name:"git",type:"confirm",message:r.gitMessage,default:!0}]);n&&(s("git init"),E(e))}};var A="2.0.0-beta.79";const P=e("vuepress-theme-hope"),z=A;P.command("[dir]","Generate a new vuepress-theme-hope project").usage("pnpm create vuepress-theme-hope@next [dir] / npm init vuepress-theme-hope@next [dir]").example("docs").action((async e=>{if(!e)return P.outputHelp();const{lang:r,message:o}=await(async()=>{const{language:e}=await t.prompt([{name:"language",type:"list",message:"Select a language to display / 选择显示语言",choices:["english (US)","简体中文"]}]);return{lang:e,message:y[e]}})();if(e.startsWith("[")&&e.endsWith("]"))return console.log(o.dirError);console.log(o.getVersion),await k(e,o),await G(e,r,o);const a=await b(r);console.log(o.install),console.warn(o.wait),s(`${f} install ${"pnpm"===f?"":`--registry ${a}`}`,{stdout:"inherit"}),console.log(o.success);const{choice:i}=await t.prompt([{name:"choice",type:"confirm",message:o.devServerAsk,default:!0}]);i?(console.log(o.devServer),await n(`${f} run docs:dev`,{stdout:"inherit"})):console.log(o.hint)})),P.help((()=>[{title:"pnpm create vuepress-theme-hope@next [dir] / npm init vuepress-theme-hope@next [dir]",body:"Create a vuepress-theme-hope template in [dir]"}])),P.version(z),P.parse();
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-vuepress-theme-hope",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.80",
|
|
4
4
|
"description": "Create vuepress-theme-hope demo project helper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"create",
|
|
7
7
|
"vuepress",
|
|
8
|
+
"vuepress2",
|
|
9
|
+
"vuepress-theme",
|
|
8
10
|
"vuepress-theme-hope"
|
|
9
11
|
],
|
|
10
12
|
"homepage": "https://vuepress-theme-hope.github.io/v2/",
|
|
@@ -22,20 +24,27 @@
|
|
|
22
24
|
"email": "mister-hope@outlook.com",
|
|
23
25
|
"url": "https://mrhope.site"
|
|
24
26
|
},
|
|
27
|
+
"type": "module",
|
|
25
28
|
"bin": {
|
|
26
|
-
"create-vuepress-theme-hope": "./lib/
|
|
29
|
+
"create-vuepress-theme-hope": "./lib/index.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"lib",
|
|
33
|
+
"template"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"cac": "^6.7.12",
|
|
37
|
+
"execa": "^6.1.0",
|
|
38
|
+
"inquirer": "^8.2.4"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/inquirer": "8.2.1",
|
|
42
|
+
"rimraf": "3.0.2"
|
|
27
43
|
},
|
|
28
44
|
"scripts": {
|
|
29
45
|
"build": "rollup -c",
|
|
30
46
|
"clean": "rimraf ./lib ./*.tsbuildinfo",
|
|
31
|
-
"dev": "
|
|
47
|
+
"dev": "pnpm dev:ts",
|
|
32
48
|
"dev:ts": "tsc -b tsconfig.build.json --watch"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
"@types/inquirer": "^8.2.0",
|
|
36
|
-
"cac": "^6.7.12",
|
|
37
|
-
"execa": "^5.1.1",
|
|
38
|
-
"inquirer": "^8.2.1"
|
|
39
|
-
},
|
|
40
|
-
"gitHead": "646fe86ed1406a1a3f093961289e325c6b1b87f9"
|
|
41
|
-
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { defineUserConfig } from "vuepress";
|
|
2
|
+
import theme from "./theme";
|
|
3
3
|
|
|
4
|
-
export default
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export default defineUserConfig({
|
|
5
|
+
lang: "en-US",
|
|
6
|
+
title: "Theme Demo",
|
|
7
|
+
description: "A demo for vuepress-theme-hope",
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[
|
|
11
|
-
"link",
|
|
12
|
-
{
|
|
13
|
-
rel: "stylesheet",
|
|
14
|
-
href: "//at.alicdn.com/t/font_2410206_mfj6e1vbwo.css",
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
],
|
|
18
|
-
|
|
19
|
-
locales: {
|
|
20
|
-
"/": {
|
|
21
|
-
lang: "en-US",
|
|
22
|
-
title: "Theme Demo",
|
|
23
|
-
description: "A demo for vuepress-theme-hope",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
9
|
+
base: "/",
|
|
26
10
|
|
|
27
|
-
|
|
11
|
+
theme,
|
|
28
12
|
});
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sidebar } from "vuepress-theme-hope";
|
|
2
2
|
|
|
3
|
-
export default
|
|
4
|
-
"",
|
|
5
|
-
"home",
|
|
6
|
-
"slide",
|
|
3
|
+
export default sidebar([
|
|
4
|
+
"/",
|
|
5
|
+
"/home",
|
|
6
|
+
"/slide",
|
|
7
7
|
{
|
|
8
8
|
icon: "creative",
|
|
9
9
|
text: "Guide",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
children: ["page", "markdown", "disable", "encrypt"],
|
|
10
|
+
prefix: "/guide/",
|
|
11
|
+
link: "/guide/",
|
|
12
|
+
children: "structure",
|
|
14
13
|
},
|
|
15
14
|
{
|
|
16
15
|
text: "Articles",
|
|
17
16
|
icon: "note",
|
|
18
|
-
prefix: "posts/",
|
|
17
|
+
prefix: "/posts/",
|
|
19
18
|
children: [
|
|
20
19
|
{
|
|
21
20
|
text: "Articles 1-4",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hopeTheme } from "vuepress-theme-hope";
|
|
2
2
|
import navbar from "./navbar";
|
|
3
3
|
import sidebar from "./sidebar";
|
|
4
4
|
|
|
5
|
-
export default
|
|
5
|
+
export default hopeTheme({
|
|
6
6
|
hostname: "https://vuepress-theme-hope-v2-demo.mrhope.site",
|
|
7
7
|
|
|
8
8
|
author: {
|
|
@@ -10,11 +10,11 @@ export default defineThemeConfig({
|
|
|
10
10
|
url: "https://mrhope.site",
|
|
11
11
|
},
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
iconAssets: "iconfont",
|
|
14
14
|
|
|
15
15
|
logo: "/logo.svg",
|
|
16
16
|
|
|
17
|
-
repo: "
|
|
17
|
+
repo: "vuepress-theme-hope/vuepress-theme-hope",
|
|
18
18
|
|
|
19
19
|
docsDir: "demo/src",
|
|
20
20
|
|
|
@@ -28,6 +28,8 @@ export default defineThemeConfig({
|
|
|
28
28
|
|
|
29
29
|
displayFooter: true,
|
|
30
30
|
|
|
31
|
+
pageInfo: ["Author", "Original", "Date", "Category", "Tag", "ReadingTime"],
|
|
32
|
+
|
|
31
33
|
blog: {
|
|
32
34
|
description: "A FrontEnd programmer",
|
|
33
35
|
intro: "/intro.html",
|
|
@@ -75,9 +77,30 @@ export default defineThemeConfig({
|
|
|
75
77
|
autoExcerpt: true,
|
|
76
78
|
},
|
|
77
79
|
|
|
80
|
+
// If you don't need comment feature, you can remove following option
|
|
81
|
+
// The following config is for demo ONLY, if you need comment feature, please generate and use your own config, see comment plugin documentation for details.
|
|
82
|
+
// To avoid disturbing the theme developer and consuming his resources, please DO NOT use the following config directly in your production environment!!!!!
|
|
78
83
|
comment: {
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Using Giscus
|
|
86
|
+
*/
|
|
87
|
+
provider: "Giscus",
|
|
88
|
+
repo: "vuepress-theme-hope/giscus-discussions",
|
|
89
|
+
repoId: "R_kgDOG_Pt2A",
|
|
90
|
+
category: "Announcements",
|
|
91
|
+
categoryId: "DIC_kwDOG_Pt2M4COD69",
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Using Twikoo
|
|
95
|
+
*/
|
|
96
|
+
// provider: "Twikoo",
|
|
97
|
+
// envId: "https://twikoo.ccknbc.vercel.app",
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Using Waline
|
|
101
|
+
*/
|
|
102
|
+
// provider: "Waline",
|
|
103
|
+
// serverURL: "https://vuepress-theme-hope-comment.vercel.app",
|
|
81
104
|
},
|
|
82
105
|
|
|
83
106
|
mdEnhance: {
|
package/template/en-US/README.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
+
title: Guides
|
|
3
|
+
index: false
|
|
2
4
|
icon: creative
|
|
3
5
|
category:
|
|
4
6
|
- Guide
|
|
5
7
|
---
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- [Page Config](page.md)
|
|
9
|
+
## Catalog
|
|
10
10
|
|
|
11
11
|
- [Markdown Enhance](markdown.md)
|
|
12
12
|
|
|
13
|
+
- [Page Config](page.md)
|
|
14
|
+
|
|
13
15
|
- [Function Disable](disable.md)
|
|
14
16
|
|
|
15
17
|
- [Encryption Demo](encrypt.md)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: Disabling layout and features
|
|
3
3
|
icon: config
|
|
4
|
+
order: 3
|
|
4
5
|
category:
|
|
5
6
|
- Guide
|
|
6
7
|
tag:
|
|
@@ -22,11 +23,11 @@ footer: false
|
|
|
22
23
|
backtotop: false
|
|
23
24
|
---
|
|
24
25
|
|
|
25
|
-
You can disable some
|
|
26
|
+
You can disable some function and layout on the page by setting the Frontmatter of the page.
|
|
26
27
|
|
|
27
28
|
<!-- more -->
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
This page is an demo that disables the following features:
|
|
30
31
|
|
|
31
32
|
- Navbar
|
|
32
33
|
- Sidebar
|
|
@@ -1,59 +1,94 @@
|
|
|
1
1
|
---
|
|
2
|
-
icon: markdown
|
|
3
2
|
title: Markdown Enhance
|
|
3
|
+
icon: markdown
|
|
4
|
+
order: 2
|
|
4
5
|
category:
|
|
5
6
|
- Guide
|
|
6
7
|
tag:
|
|
7
|
-
-
|
|
8
|
+
- Markdown
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
VuePress basically generate pages from Markdown files. So you can use it to generate documentation or blog sites easily.
|
|
11
12
|
|
|
12
|
-
You
|
|
13
|
+
You should create and write Markdown files, so that VuePress can convert them to different pages according to file structure.
|
|
13
14
|
|
|
14
15
|
<!-- more -->
|
|
15
16
|
|
|
16
|
-
## Markdown
|
|
17
|
+
## Markdown Introduction
|
|
18
|
+
|
|
19
|
+
If you are a new learner and don’t know how to write Markdown, please read [Markdown Intro](https://vuepress-theme-hope.github.io/v2/cookbook/markdown/) and [Markdown Demo](https://vuepress-theme-hope.github.io/v2/cookbook/markdown/demo.html).
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
## Markdown Config
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
VuePress introduce configuration for each markdown page using Frontmatter.
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
::: info
|
|
26
|
+
|
|
27
|
+
Frontmatter is a important concept in VuePress. If you don’t know it, you need to read [Frontmatter Introduction](https://vuepress-theme-hope.github.io/v2/cookbook/vuepress/page.html#front-matter).
|
|
23
28
|
|
|
24
29
|
:::
|
|
25
30
|
|
|
26
|
-
##
|
|
31
|
+
## Markdown Extension
|
|
32
|
+
|
|
33
|
+
The Markdown content in VuePress will be parsed by [markdown-it](https://github.com/markdown-it/markdown-it), which supports [syntax extensions](https://github.com/markdown-it/markdown-it#syntax-extensions) via markdown-it plugins.
|
|
34
|
+
|
|
35
|
+
### VuePress Enhancement
|
|
27
36
|
|
|
28
37
|
To enrich document writing, VuePress has extended Markdown syntax.
|
|
29
38
|
|
|
30
39
|
For these extensions, please read [Markdown extensions in VuePress](https://vuepress-theme-hope.github.io/v2/basic/vuepress/markdown.html).
|
|
31
40
|
|
|
32
|
-
|
|
41
|
+
### Theme Enhancement
|
|
42
|
+
|
|
43
|
+
By using [`vuepress-plugin-md-enhance`][md-enhance], the theme extends more Markdown syntax and provides richer writing functions.
|
|
44
|
+
|
|
45
|
+
:::: tip Enable all
|
|
46
|
+
|
|
47
|
+
You can set `plugins.mdEnhance.enableAll: true` in theme options to enable all features of the [md-enhance][md-enhance] plugin.
|
|
48
|
+
|
|
49
|
+
::: code-tabs#language
|
|
50
|
+
|
|
51
|
+
@tab TS
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { hopeTheme } from "vuepress-theme-hope";
|
|
55
|
+
|
|
56
|
+
export default {
|
|
57
|
+
theme: hopeTheme({
|
|
58
|
+
plugins: {
|
|
59
|
+
mdEnhance: {
|
|
60
|
+
enableAll: true,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
```
|
|
33
66
|
|
|
34
|
-
|
|
67
|
+
@tab JS
|
|
35
68
|
|
|
36
|
-
|
|
69
|
+
```js
|
|
70
|
+
const { hopeTheme } = require("vuepress-theme-hope");
|
|
37
71
|
|
|
38
|
-
```js {3-5}
|
|
39
72
|
module.exports = {
|
|
40
|
-
|
|
73
|
+
theme: hopeTheme({
|
|
41
74
|
plugins: {
|
|
42
75
|
mdEnhance: {
|
|
43
76
|
enableAll: true,
|
|
44
77
|
},
|
|
45
78
|
},
|
|
46
|
-
},
|
|
79
|
+
}),
|
|
47
80
|
};
|
|
48
81
|
```
|
|
49
82
|
|
|
50
|
-
|
|
83
|
+
:::
|
|
84
|
+
|
|
85
|
+
::::
|
|
51
86
|
|
|
52
|
-
|
|
87
|
+
#### Custom Container
|
|
53
88
|
|
|
54
89
|
::: v-pre
|
|
55
90
|
|
|
56
|
-
Safely use {{ variable }} in
|
|
91
|
+
Safely use {{ variable }} in Markdown.
|
|
57
92
|
|
|
58
93
|
:::
|
|
59
94
|
|
|
@@ -96,7 +131,7 @@ A custom details container
|
|
|
96
131
|
```md
|
|
97
132
|
::: v-pre
|
|
98
133
|
|
|
99
|
-
Safely use {{ variable }} in
|
|
134
|
+
Safely use {{ variable }} in Markdown.
|
|
100
135
|
|
|
101
136
|
:::
|
|
102
137
|
|
|
@@ -133,19 +168,45 @@ A custom details container
|
|
|
133
168
|
|
|
134
169
|
::::
|
|
135
170
|
|
|
136
|
-
|
|
171
|
+
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/container.html)
|
|
172
|
+
|
|
173
|
+
### Tabs
|
|
174
|
+
|
|
175
|
+
::: tabs#fruit
|
|
176
|
+
|
|
177
|
+
@tab apple
|
|
178
|
+
|
|
179
|
+
Apple
|
|
137
180
|
|
|
138
|
-
|
|
181
|
+
@tab banana
|
|
139
182
|
|
|
140
|
-
|
|
183
|
+
Banana
|
|
184
|
+
|
|
185
|
+
@tab orange
|
|
186
|
+
|
|
187
|
+
Orange
|
|
188
|
+
|
|
189
|
+
:::
|
|
190
|
+
|
|
191
|
+
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/tabs.html)
|
|
192
|
+
|
|
193
|
+
#### Code Tabs
|
|
194
|
+
|
|
195
|
+
::: code-tabs
|
|
196
|
+
|
|
197
|
+
@tab pnpm
|
|
141
198
|
|
|
142
199
|
```bash
|
|
143
|
-
|
|
200
|
+
pnpm add -D vuepress-theme-hope
|
|
144
201
|
```
|
|
145
202
|
|
|
146
|
-
|
|
203
|
+
@tab yarn
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
yarn add -D vuepress-theme-hope
|
|
207
|
+
```
|
|
147
208
|
|
|
148
|
-
|
|
209
|
+
@tab:active npm
|
|
149
210
|
|
|
150
211
|
```bash
|
|
151
212
|
npm i -D vuepress-theme-hope
|
|
@@ -153,17 +214,15 @@ npm i -D vuepress-theme-hope
|
|
|
153
214
|
|
|
154
215
|
:::
|
|
155
216
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/code-group.html)
|
|
217
|
+
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/code-tabs.html)
|
|
159
218
|
|
|
160
|
-
|
|
219
|
+
#### Superscript and Subscript
|
|
161
220
|
|
|
162
221
|
19^th^ H~2~O
|
|
163
222
|
|
|
164
223
|
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/sup-sub.html)
|
|
165
224
|
|
|
166
|
-
|
|
225
|
+
#### Align
|
|
167
226
|
|
|
168
227
|
::: center
|
|
169
228
|
|
|
@@ -179,7 +238,7 @@ I am right align
|
|
|
179
238
|
|
|
180
239
|
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/align.html)
|
|
181
240
|
|
|
182
|
-
|
|
241
|
+
#### Footnote
|
|
183
242
|
|
|
184
243
|
This text has footnote[^first].
|
|
185
244
|
|
|
@@ -187,20 +246,88 @@ This text has footnote[^first].
|
|
|
187
246
|
|
|
188
247
|
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/footnote.html)
|
|
189
248
|
|
|
190
|
-
|
|
249
|
+
#### Mark
|
|
191
250
|
|
|
192
251
|
You can mark ==important words== .
|
|
193
252
|
|
|
194
253
|
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/mark.html)
|
|
195
254
|
|
|
196
|
-
|
|
255
|
+
#### Tasklist
|
|
197
256
|
|
|
198
257
|
- [x] Plan A
|
|
199
258
|
- [ ] Plan B
|
|
200
259
|
|
|
201
260
|
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/tasklist.html)
|
|
202
261
|
|
|
203
|
-
|
|
262
|
+
#### Image Enhancement
|
|
263
|
+
|
|
264
|
+
Support setting color scheme and size
|
|
265
|
+
|
|
266
|
+
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/image.md)
|
|
267
|
+
|
|
268
|
+
#### Chart
|
|
269
|
+
|
|
270
|
+
::: chart A Scatter Chart
|
|
271
|
+
|
|
272
|
+
```json
|
|
273
|
+
{
|
|
274
|
+
"type": "scatter",
|
|
275
|
+
"data": {
|
|
276
|
+
"datasets": [
|
|
277
|
+
{
|
|
278
|
+
"label": "Scatter Dataset",
|
|
279
|
+
"data": [
|
|
280
|
+
{ "x": -10, "y": 0 },
|
|
281
|
+
{ "x": 0, "y": 10 },
|
|
282
|
+
{ "x": 10, "y": 5 },
|
|
283
|
+
{ "x": 0.5, "y": 5.5 }
|
|
284
|
+
],
|
|
285
|
+
"backgroundColor": "rgb(255, 99, 132)"
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
"options": {
|
|
290
|
+
"scales": {
|
|
291
|
+
"x": {
|
|
292
|
+
"type": "linear",
|
|
293
|
+
"position": "bottom"
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
:::
|
|
301
|
+
|
|
302
|
+
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/chart.html)
|
|
303
|
+
|
|
304
|
+
#### Echarts
|
|
305
|
+
|
|
306
|
+
::: echarts A line chart
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
{
|
|
310
|
+
"xAxis": {
|
|
311
|
+
"type": "category",
|
|
312
|
+
"data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
|
|
313
|
+
},
|
|
314
|
+
"yAxis": {
|
|
315
|
+
"type": "value"
|
|
316
|
+
},
|
|
317
|
+
"series": [
|
|
318
|
+
{
|
|
319
|
+
"data": [150, 230, 224, 218, 135, 147, 260],
|
|
320
|
+
"type": "line"
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
:::
|
|
327
|
+
|
|
328
|
+
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/echarts.html)
|
|
329
|
+
|
|
330
|
+
#### Flowchart
|
|
204
331
|
|
|
205
332
|
```flow
|
|
206
333
|
cond=>condition: Process?
|
|
@@ -213,7 +340,7 @@ cond(no)->e
|
|
|
213
340
|
|
|
214
341
|
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/flowchart.html)
|
|
215
342
|
|
|
216
|
-
|
|
343
|
+
#### Mermaid
|
|
217
344
|
|
|
218
345
|
```mermaid
|
|
219
346
|
flowchart TB
|
|
@@ -234,7 +361,7 @@ flowchart TB
|
|
|
234
361
|
|
|
235
362
|
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/mermaid.html)
|
|
236
363
|
|
|
237
|
-
|
|
364
|
+
#### Tex
|
|
238
365
|
|
|
239
366
|
$$
|
|
240
367
|
\frac {\partial^r} {\partial \omega^r} \left(\frac {y^{\omega}} {\omega}\right)
|
|
@@ -243,9 +370,15 @@ $$
|
|
|
243
370
|
|
|
244
371
|
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/tex.html)
|
|
245
372
|
|
|
246
|
-
|
|
373
|
+
#### Include files
|
|
374
|
+
|
|
375
|
+
@include(./README.md{11-17})
|
|
376
|
+
|
|
377
|
+
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/include.md)
|
|
247
378
|
|
|
248
|
-
|
|
379
|
+
#### Code Demo
|
|
380
|
+
|
|
381
|
+
::: normal-demo A normal demo
|
|
249
382
|
|
|
250
383
|
```html
|
|
251
384
|
<h1>VuePress Theme Hope</h1>
|
|
@@ -268,7 +401,15 @@ span {
|
|
|
268
401
|
|
|
269
402
|
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/demo.html)
|
|
270
403
|
|
|
271
|
-
|
|
404
|
+
#### Stylize
|
|
405
|
+
|
|
406
|
+
<!-- markdownlint-disable MD033 -->
|
|
407
|
+
|
|
408
|
+
Setting this to a invalid stytax <span style="color:red">doesn't</span> have any effect.
|
|
409
|
+
|
|
410
|
+
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/stylize.md)
|
|
411
|
+
|
|
412
|
+
#### Presentation
|
|
272
413
|
|
|
273
414
|
@slidestart
|
|
274
415
|
|
|
@@ -302,3 +443,5 @@ $$
|
|
|
302
443
|
@slideend
|
|
303
444
|
|
|
304
445
|
- [View Detail](https://vuepress-theme-hope.github.io/v2/guide/markdown/presentation.html)
|
|
446
|
+
|
|
447
|
+
[md-enhance]: https://vuepress-theme-hope.github.io/v2/md-enhance/
|