-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple Language Support + Complete Chinese Translation #48
Merged
+1,304
−47
Merged
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
0494566
dropdown - init
ulivz 121e6ca
add nav link component to distinguish internal and external link
ulivz 3ddca36
enhance the active state of dropdown link
ulivz 72be30c
beautify font weight for dropdown link and clean code
ulivz 4bccf3a
clean code
ulivz 5ac3c2a
update doc
ulivz dbb7a08
update README
ulivz 50689ea
address comments
ulivz 6de2efa
fix jumpy link
ulivz a760d59
i18n - init
ulivz 7eb2563
address comments
ulivz 94c2236
use exact match mode for route link
ulivz 0c53333
Merge branch 'dropdown' into i18n
ulivz e30c580
support configurable i18n
ulivz c6188b9
translate README of guide
ulivz d414794
tweaks translations and update the actionLink
ulivz 8a131a9
add sidebar config for zh
ulivz 711e772
translate basic-config and getting-started
ulivz 34d8d78
refactor code
ulivz 6c9e1a4
implement nested links in dropdown
ulivz 5ca1d02
clean dropdown type
ulivz 7c6d462
fix cursor status
ulivz 96c30c5
chore: tweaks
ulivz 3397dc2
Merge branch 'master' into dropdown
ulivz f8e10cf
Merge branch 'dropdown' into i18n
ulivz 7ea050e
zh - translate guide/assets
ulivz 00e6430
zh - translate guide/markdown
ulivz dbf07fb
zh - translate guide/using-vue
ulivz 9506184
zh - translate guide/custom-themes
ulivz 8a900a4
zh - translate guide/deploy
ulivz 79eff60
zh - translate /config/
ulivz 01ab22e
zh - translate /default-theme-config/
ulivz 08d80b1
correct some mistakes in Chinses translation.
ulivz 6ebbd88
refactor docs
ulivz eee3ac7
style: tweaks style of navbar to fully follow sidebar at mobile side.
ulivz a811af5
refactor Chinese translations
ulivz 5030421
Merge branch 'master' into dropdown
ulivz 96a6cc6
refactor: address comments and clean duplicate code due to merging.
ulivz 7f440d0
style: use more exact class selector, and clean old element selector …
ulivz 069d677
Merge branch 'dropdown' into multiple-language-support
ulivz 645c22d
chore: fix merge conflict
ulivz 028669b
Merge branch 'master' into multiple-language-support
ulivz 2d76589
support multiple langs for title and homepage link
ulivz ddf759f
handle for lang and description - dev & build
ulivz c779dde
handle description meta at dev mode
ulivz 5c7190d
Merge branch 'master' into multiple-language-support
ulivz e64fd82
translate latest updated doc
ulivz 4e769a6
Complete proofreading
ulivz beac14f
feat: Auto-generated language dropdown if user configured langs
ulivz b8dc3f0
feat: Try to stay on the current page When user switch the language
ulivz f2fb2d9
chore: clean code
ulivz 4f1b004
chore: clean code
ulivz c5a2079
fix: typo
ulivz 961cf2d
feat: support override description meta with yaml front matter
ulivz 1c31f82
replace those IE11-incompatible API with ES5
ulivz b794126
docs: document config.host for zh-CN
ulivz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,34 @@ | ||
--- | ||
home: true | ||
heroImage: /hero.png | ||
actionText: 快速上手 → | ||
actionLink: /zh/guide/ | ||
features: | ||
- title: 简洁至上 | ||
details: 以 Markdown 为中心的项目结构,以最少的配置帮助你专注于写作。 | ||
- title: Vue驱动 | ||
details: 享受 Vue + webpack 的开发体验,可以在 Markdown 中使用 Vue 组件,又可以使用 Vue 来开发自定义主题。 | ||
- title: 高性能 | ||
details: VuePress 会为每个页面预渲染生成静态的 HTML,同时,每个页面被加载的时候,将作为 SPA 运行。 | ||
footer: MIT Licensed | Copyright © 2018-present Evan You | ||
--- | ||
|
||
### 像数 1, 2, 3 一样容易 | ||
|
||
``` bash | ||
# 安装 | ||
yarn global add vuepress # 或者:npm install -g vuepress | ||
|
||
# 新建一个 markdown 文件 | ||
echo '# Hello VuePress!' > README.md | ||
|
||
# 开始写作 | ||
vuepress dev . | ||
|
||
# 构建静态文件 | ||
vuepress build . | ||
``` | ||
|
||
::: warning NODE VERSION | ||
请确保你 Node.js 的版本大于 8。 | ||
::: |
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,201 @@ | ||
--- | ||
sidebar: auto | ||
--- | ||
|
||
# 配置 | ||
|
||
## 基本配置 | ||
|
||
### base | ||
|
||
- 类型: `string` | ||
- 默认值: `/` | ||
|
||
部署站点的基础路径,如果你想让你的网站部署到一个子路径下,你将需要设置它。如 Github pages,如果你想将你的网站部署到 `https://foo.github.io/bar/`,那么 `base` 应该被设置成 `"/bar/"`,它的值应当总是以斜杠开始,并以斜杠结束。 | ||
|
||
`base` 将会自动地作为前缀插入到所有以 `/` 开始的其他选项的链接中,所以你只需要指定一次。 | ||
|
||
**Also see:** | ||
|
||
- [Base URL](../guide/assets.md#base-url) | ||
- [部署指南 > Github Pages](../guide/deploy.md#github-pages) | ||
|
||
### title | ||
|
||
- 类型: `string` | ||
- 默认值: `undefined` | ||
|
||
网站的标题,它将会被用作所有页面标题的前缀,同时,默认主题下,它将显示在导航栏(navbar)上。 | ||
|
||
### description | ||
|
||
- 类型: `string` | ||
- 默认值: `undefined` | ||
|
||
网站的描述,它将会以 `<meta>` 标签渲染到当前页面的 HTML 中。 | ||
|
||
### head | ||
|
||
- 类型: `Array` | ||
- 默认值: `[]` | ||
|
||
额外的需要被注入到当前页面的 HTML `<head>` 中的标签,每个标签都可以以 `[tagName, { attrName: attrValue }, innerHTML?]` 的格式指定,举个例子,增加一个自定义的 favicon: | ||
|
||
``` js | ||
module.exports = { | ||
head: [ | ||
['link', { rel: 'icon', href: `/logo.png` }] | ||
] | ||
} | ||
``` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 新加了一个 host 选项,可以补上 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed at b794126 |
||
### host | ||
|
||
- Type: `string` | ||
- Default: `'0.0.0.0'` | ||
|
||
指定用于 dev server 的主机名。 | ||
|
||
### port | ||
|
||
- 类型: `number` | ||
- 默认值: `8080` | ||
|
||
指定 dev server 的端口。 | ||
|
||
### dest | ||
|
||
- 类型: `string` | ||
- 默认值: `.vuepress/dist` | ||
|
||
指定 `vuepress build` 的输出目录。 | ||
|
||
### ga | ||
|
||
- 类型: `string` | ||
- 默认值: `undefined` | ||
|
||
提供一个 Google Analytics ID 来使 GA 生效。 | ||
|
||
### serviceWorker | ||
|
||
- 类型: `boolean` | ||
- 默认值: `false` | ||
|
||
如果设置成 `true`,VuePress 将会自动生成并且注册一个 service worker,它缓存了那些已访问过的页面的内容,用于离线访问(仅在生产环境生效)。 | ||
|
||
如果你正在开发一个自定义主题,`Layout.vue` 组件将会自动触发下述的事件: | ||
|
||
- `sw-ready` | ||
- `sw-cached` | ||
- `sw-updated` | ||
- `sw-offline` | ||
- `sw-error` | ||
|
||
::: tip PWA NOTES | ||
`serviceWorker` 仅仅用来控制 service worker,为了让你的网站完全地兼容 PWA,你需要在 `.vuepress/public` 提供 Manifest 和 icons,更多细节,请参见 [MDN docs about the Web App Manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest). | ||
当然,仅仅只在你的网站部署后能用 SSL 的时候开启它,因为 service worker 只能在 HTTPs 的链接下注册。 | ||
::: | ||
|
||
## 主题 | ||
|
||
### theme | ||
|
||
- 类型: `string` | ||
- 默认值: `undefined` | ||
|
||
当你使用自定义主题的时候,需要指定它。当值为 `"foo"` 时,VuePress 将会尝试去加载位于 `node_modules/vuepress-theme-awesome/Layout.vue` 的主题组件。 | ||
|
||
### themeConfig | ||
|
||
- 类型: `Object` | ||
- 默认值: `{}` | ||
|
||
为当前的主题提供一些配置,这些选项依赖于你正在使用的主题。 | ||
|
||
**也可以参考:** | ||
|
||
- [默认主题](../default-theme-config/)。 | ||
|
||
## Markdown | ||
|
||
### markdown.anchor | ||
|
||
- 类型: `Object` | ||
- 默认值: `{ permalink: true, permalinkBefore: true, permalinkSymbol: '#' }` | ||
|
||
[markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor) 的选项。 | ||
|
||
### markdown.toc | ||
|
||
- 类型: `Object` | ||
- 默认值: `{ includeLevel: [2, 3] }` | ||
|
||
[markdown-it-table-of-contents](https://github.com/Oktavilla/markdown-it-table-of-contents) 的选项。 | ||
|
||
### markdown.config | ||
|
||
- 类型: `Function` | ||
- 默认值: `undefined` | ||
|
||
一个用来对当前的 [markdown-it](https://github.com/markdown-it/markdown-it) 实例应用额外的插件的函数,举例如下: | ||
|
||
``` js | ||
module.exports = { | ||
markdown: { | ||
config: md => { | ||
md.use(require('markdown-it-xxx')) | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## 构建流程 | ||
|
||
### postcss | ||
|
||
- 类型: `Object` | ||
- 默认值: `{ plugins: [require('autoprefixer')] }` | ||
|
||
[postcss-loader](https://github.com/postcss/postcss-loader) 的选项,请注意,指定这个值,将会覆盖内置的 autoprefixer,所以你需要自己将它加进去。 | ||
|
||
### configureWebpack | ||
|
||
- 类型: `Object | Function` | ||
- 默认值: `undefined` | ||
|
||
用于修改内部的 Webpack 配置。如果给定一个对象,那么它将会被 [webpack-merge](https://github.com/survivejs/webpack-merge) 合并到最终的配置中,如果给定一个函数,它将会接受 `config` 作为第一个参数,以及 `isServer` 作为第二个参数,你可以直接更改 `config`,也可以返回一个待合并的对象。 | ||
|
||
``` js | ||
module.exports = { | ||
configureWebpack: (config, isServer) => { | ||
if (!isServer) { | ||
// 修改客户端的 webpack 配置 | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### chainWebpack | ||
|
||
- 类型: `Function` | ||
- 默认值: `undefined` | ||
|
||
通过 [webpack-chain](https://github.com/mozilla-neutrino/webpack-chain) 来修改内部的 Webpack 配置。 | ||
|
||
``` js | ||
module.exports = { | ||
chainWebpack: (config, isServer) => { | ||
// config 是 ChainableConfig 的一个实例 | ||
} | ||
} | ||
``` | ||
|
||
## 浏览器兼容性 | ||
|
||
### evergreen | ||
|
||
- 类型: `boolean` | ||
- 默认值: `false` | ||
|
||
如果你的对象只有那些 “常青树” 浏览器,你可以将其设置成 `true`,这将会禁止 ESNext 到 ES5 的转译以及对 IE 的 polyfills,同时会带来更快的构建速度和更小的文件体积。 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sidebar 配置除了 title 之外其实是一样的,可以抽取出来