Skip to content

Commit 180caff

Browse files
committed
Merge branch 'master' of github.com:vuejs/vuepress into explode-md-includes
2 parents f30264d + 596014f commit 180caff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1411
-305
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ https://vuepress.vuejs.org/
2626
- [Multi-Language Support](https://vuepress.vuejs.org/guide/i18n.html)
2727
- A default theme with:
2828
- Responsive layout
29-
- Optional Homepage
30-
- [Automatic basic typeahead search](https://vuepress.vuejs.org/default-theme-config/#built-in-search)
29+
- [Optional Homepage](https://vuepress.vuejs.org/default-theme-config/#homepage)
30+
- [Simple out-of-the-box header-based search](https://vuepress.vuejs.org/default-theme-config/#built-in-search)
3131
- [Algolia Search](https://vuepress.vuejs.org/default-theme-config/#algolia-search)
3232
- Customizable navbar and sidebar
33-
- Auto-generated GitHub link and page edit links
33+
- [Auto-generated GitHub link and page edit links](https://vuepress.vuejs.org/default-theme-config/#git-repo-and-edit-links)
3434

3535
## Todo Features
3636

docs/.vuepress/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ module.exports = {
3434
label: 'English',
3535
selectText: 'Languages',
3636
editLinkText: 'Edit this page on GitHub',
37+
lastUpdated: 'Last Updated',
3738
nav: [
3839
{
3940
text: 'Guide',
@@ -56,6 +57,7 @@ module.exports = {
5657
label: '简体中文',
5758
selectText: '选择语言',
5859
editLinkText: '在 GitHub 上编辑此页',
60+
lastUpdated: '上次更新',
5961
nav: [
6062
{
6163
text: '指南',

docs/config/README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Extra tags to be injected to the page HTML `<head>`. Each tag can be specified i
4444
``` js
4545
module.exports = {
4646
head: [
47-
['link', { rel: 'icon', href: `/logo.png` }]
47+
['link', { rel: 'icon', href: '/logo.png' }]
4848
]
4949
}
5050
```
@@ -127,13 +127,27 @@ Provide config options to the used theme. The options will vary depending on the
127127

128128
## Markdown
129129

130+
### markdown.lineNumbers
131+
132+
- Type: `boolean`
133+
- Default: `undefined`
134+
135+
Whether to show line numbers to the left of each code blocks.
136+
130137
### markdown.slugify
131138

132139
- Type: `Function`
133140
- Default: [source](https://github.com/vuejs/vuepress/blob/master/lib/markdown/slugify.js)
134141

135142
Function for transforming header texts into slugs. This affects the ids/links generated for header anchors, table of contents and sidebar links.
136143

144+
### markdown.externalLinks
145+
146+
- Type: `Object`
147+
- Default: `{ target: '_blank', rel: 'noopener noreferrer' }`
148+
149+
The key and value pair will be added to `<a>` tags that points to an external link. The default option will open external links in a new window.
150+
137151
### markdown.anchor
138152

139153
- Type: `Object`

docs/default-theme-config/README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Built-in Search only builds index from the title, `h2` and `h3` headers, if you
267267

268268
The `themeConfig.algolia` option allows you to use [Algolia DocSearch](https://community.algolia.com/docsearch/) to replace the simple built-in search. To enable it, you need to provide at least `apiKey` and `indexName`:
269269

270-
```js
270+
``` js
271271
module.exports = {
272272
themeConfig: {
273273
algolia: {
@@ -280,6 +280,24 @@ module.exports = {
280280

281281
For more options, refer to [Algolia DocSearch's documentation](https://github.com/algolia/docsearch#docsearch-options).
282282

283+
## Last Updated
284+
285+
The `themeConfig.lastUpdated` option allows you to get the UNIX timestamp(ms) of each file's last `git` commit, and it will also display at the bottom of each page with a appropriate format:
286+
287+
``` js
288+
module.exports = {
289+
themeConfig: {
290+
lastUpdated: 'Last Updated', // string | boolean
291+
}
292+
}
293+
```
294+
295+
Note that it's `off` by default. If given `string`, it will be displayed as a prefix (default value: `Last Updated`).
296+
297+
::: warning
298+
Since `lastUpdated` is based on `git`, so you can only use it in a `git` repository.
299+
:::
300+
283301
## Prev / Next Links
284302

285303
Prev and next links are automatically inferred based on the sidebar order of the active page. You can also explicitly overwrite or disable them using `YAML front matter`:
@@ -313,7 +331,7 @@ module.exports = {
313331
docsDir: 'docs',
314332
// if your docs are in a specific branch (defaults to 'master'):
315333
docsBranch: 'master',
316-
// defaults to true, set to false to disable
334+
// defaults to false, set to true to enable
317335
editLinks: true,
318336
// custom text for edit link. Defaults to "Edit this page"
319337
editLinkText: 'Help us improve this page!'

docs/guide/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ Each markdown file is compiled into HTML with [markdown-it](https://github.com/m
1717
- [Built-in markdown extensions](./markdown.md) optimized for technical documentation
1818
- [Ability to leverage Vue inside markdown files](./using-vue.md)
1919
- [Vue-powered custom theme system](./custom-themes.md)
20-
- Automatic Service Worker generation
21-
- Google Analytics Integration
22-
- Multi-language support
20+
- [Automatic Service Worker generation](../config/#serviceworker)
21+
- [Google Analytics Integration](../config/#ga)
22+
- [Multi-language support](./i18n.md)
2323
- A default theme with:
2424
- Responsive layout
25-
- Optional Homepage
26-
- Simple out-of-the-box header-based search
27-
- Customizable navbar and sidebar
28-
- Auto-generated GitHub link and page edit links
25+
- [Optional Homepage](../default-theme-config/#homepage)
26+
- [Simple out-of-the-box header-based search](../default-theme-config/#built-in-search)
27+
- [Algolia Search](../default-theme-config/#algolia-search)
28+
- Customizable [navbar](../default-theme-config/#navbar) and [sidebar](../default-theme-config/#sidebar)
29+
- [Auto-generated GitHub link and page edit links](../default-theme-config/#git-repo-and-edit-links)
2930

3031
## Todo
3132

docs/guide/custom-themes.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This is the value of `$site` of this very website:
2828
"base": "/",
2929
"pages": [
3030
{
31-
"lastModified": 1524027677,
31+
"lastUpdated": 1524027677000,
3232
"path": "/",
3333
"title": "VuePress",
3434
"frontmatter": {}
@@ -44,7 +44,7 @@ This is the `$page` object for this page you are looking at:
4444

4545
``` json
4646
{
47-
"lastModified": 1524847549,
47+
"lastUpdated": 1524847549000,
4848
"path": "/guide/custom-themes.html",
4949
"title": "Custom Themes",
5050
"headers": [/* ... */],
@@ -57,7 +57,8 @@ If the user provided `themeConfig` in `.vuepress/config.js`, it will also be ava
5757
Finally, don't forget that `this.$route` and `this.$router` are also available as part of Vue Router's API.
5858

5959
::: tip
60-
`lastModified` is the UNIX timestamp of this file's last git commit, so please ensure you have git installed.
60+
`lastUpdated` is the UNIX timestamp of this file's last git commit, for more details, refer to [Last Updated](../default-theme-config/#last-updated).
61+
6162
:::
6263

6364
## Content Excerpt

docs/guide/deploy.md

Lines changed: 76 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,81 @@ pages:
102102

103103
2. Create `firebase.json` and `.firebaserc` at the root of your project with the following content:
104104

105-
`firebase.json`:
106-
```json
107-
{
108-
"hosting": {
109-
"public": "./docs/.vuepress/dist",
110-
"ignore": []
111-
}
112-
}
113-
```
114-
115-
`.firebaserc`:
116-
```js
117-
{
118-
"projects": {
119-
"default": "<YOUR_FIREBASE_ID>"
120-
}
121-
}
122-
```
105+
`firebase.json`:
106+
```json
107+
{
108+
"hosting": {
109+
"public": "./docs/.vuepress/dist",
110+
"ignore": []
111+
}
112+
}
113+
```
114+
115+
`.firebaserc`:
116+
```js
117+
{
118+
"projects": {
119+
"default": "<YOUR_FIREBASE_ID>"
120+
}
121+
}
122+
```
123123

124124
3. After running `yarn docs:build` or `npm run docs:build`, deploy with the command `firebase deploy`.
125+
126+
## Surge
127+
128+
1. First install [surge](https://www.npmjs.com/package/surge), if you haven't already.
129+
130+
2. Run `yarn docs:build` or `npm run docs:build`.
131+
132+
3. Deploy to surge, by typing `surge docs/.vuepress/dist`.
133+
134+
You can also deploy to a [custom domain](http://surge.sh/help/adding-a-custom-domain) by adding `surge docs/.vuepress/dist yourdomain.com`.
135+
136+
## Heroku
137+
138+
1. First install [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli).
139+
140+
2. Create a Heroku account [here](https://signup.heroku.com).
141+
142+
3. Run `heroku login` and fill in your Heroku credentials:
143+
144+
``` bash
145+
heroku login
146+
```
147+
148+
4. Create a file called `static.json` in the root of your project with the content below:
149+
150+
`static.json`:
151+
```json
152+
{
153+
"root": "./docs/.vuepress/dist"
154+
}
155+
```
156+
157+
This is the configuration of your site. see more at [heroku-buildpack-static](https://github.com/heroku/heroku-buildpack-static).
158+
159+
5. Set up your Heroku git remote:
160+
161+
``` bash
162+
# version change
163+
git init
164+
git add .
165+
git commit -m "My site ready for deployment."
166+
167+
# creates a new app with a specified name
168+
heroku apps:create example
169+
170+
# set buildpack for static sites
171+
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-static.git
172+
```
173+
174+
6. Deploying Your Site
175+
176+
``` bash
177+
# publish site
178+
git push heroku master
179+
180+
# opens a browser to view the Dashboard version of Heroku CI
181+
heroku open
182+
```

docs/guide/markdown.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ Given the following directory structure:
4848

4949
### External Links
5050

51-
Outbound links automatically gets `target="_blank"`:
51+
Outbound links automatically gets `target="_blank" rel="noopener noreferrer"`:
5252

5353
- [vuejs.org](https://vuejs.org)
5454
- [VuePress on GitHub](https://github.com/vuejs/vuepress)
5555

56+
You can customize the attributes added to external links by setting [config.markdown.externalLinks](../config/#markdown-externallinks).
57+
5658
## Front Matter
5759

5860
[YAML front matter](https://jekyllrb.com/docs/frontmatter/) is supported out of the box:
@@ -148,7 +150,7 @@ A list of all emojis available can be found [here](https://github.com/markdown-i
148150

149151
[[toc]]
150152

151-
Rendering of TOC can be configured using the [`markdown.toc`](../config/#markdowntoc) option.
153+
Rendering of TOC can be configured using the [`markdown.toc`](../config/#markdown-toc) option.
152154

153155
## Custom Containers
154156

docs/guide/using-vue.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Each markdown file is first compiled into HTML and then passed on as a Vue compo
4040

4141
**Output**
4242

43-
<pre><code>{{ 1 + 1 }}</code></pre>
43+
<div class="language-text"><pre><code>{{ 1 + 1 }}</code></pre></div>
4444

4545
### Directives
4646

@@ -54,7 +54,7 @@ Directives also work:
5454

5555
**Output**
5656

57-
<pre><code><span v-for="i in 3">{{ i }} </span></code></pre>
57+
<div class="language-text"><pre><code><span v-for="i in 3">{{ i }} </span></code></pre></div>
5858

5959
### Access to Site & Page Data
6060

docs/zh/config/README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ sidebar: auto
4444
``` js
4545
module.exports = {
4646
head: [
47-
['link', { rel: 'icon', href: `/logo.png` }]
47+
['link', { rel: 'icon', href: '/logo.png' }]
4848
]
4949
}
5050
```
@@ -93,8 +93,8 @@ module.exports = {
9393
- `sw-error`
9494

9595
::: tip PWA NOTES
96-
`serviceWorker` 仅仅用来控制 service worker,为了让你的网站完全地兼容 PWA,你需要在 `.vuepress/public` 提供 Manifest 和 icons,更多细节,请参见 [MDN docs about the Web App Manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest).
97-
当然,仅仅只在你的网站部署后能用 SSL 的时候开启它,因为 service worker 只能在 HTTPs 的链接下注册
96+
`serviceWorker` 选项仅仅用来控制 service worker,为了让你的网站完全地兼容 PWA,你需要在 `.vuepress/public` 提供 Manifest 和 icons,更多细节,请参见 [MDN docs about the Web App Manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest).
97+
此外,只有您能够使用 SSL 部署您的站点时才能启用此功能,因为 service worker 只能在 HTTPs 的 URL 下注册
9898
:::
9999

100100
### locales
@@ -126,13 +126,27 @@ module.exports = {
126126

127127
## Markdown
128128

129+
### markdown.lineNumbers
130+
131+
- 类型: `boolean`
132+
- 默认值: `undefined`
133+
134+
是否在每个代码块的左侧显示行号。
135+
129136
### markdown.anchor
130137

131138
- 类型: `Object`
132139
- 默认值: `{ permalink: true, permalinkBefore: true, permalinkSymbol: '#' }`
133140

134141
[markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor) 的选项。
135142

143+
### markdown.externalLinks
144+
145+
- Type: `Object`
146+
- Default: `{ target: '_blank', rel: 'noopener noreferrer' }`
147+
148+
这个键值对将会作为特性被增加到是外部链接的 `<a>` 标签上,默认的选项将会在新窗口中打开一个该外部链接。
149+
136150
### markdown.toc
137151

138152
- 类型: `Object`

docs/zh/default-theme-config/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,24 @@ module.exports = {
276276

277277
更多选项请参考 [Algolia DocSearch 的文档](https://github.com/algolia/docsearch#docsearch-options)
278278

279+
## 最近更新
280+
281+
你可以通过 `themeConfig.lastUpdated` 选项来获取每个文件最后一次 `git` 提交的 UNIX 时间戳(ms),同时它将以合适的日期格式显示在每一页的底部:
282+
283+
``` js
284+
module.exports = {
285+
themeConfig: {
286+
lastUpdated: 'Last Updated', // string | boolean
287+
}
288+
}
289+
```
290+
291+
请注意,`themeConfig.lastUpdated` 默认是关闭的,如果给定一个字符串,它将会作为前缀显示(默认值是:`Last Updated`)。
292+
293+
::: warning 使用须知
294+
由于 `lastUpdated` 是基于 `git` 的, 所以你只能在一个基于 `git` 的项目中启用它。
295+
:::
296+
279297
## 上 / 下一篇链接
280298

281299
上一篇和下一篇文章的链接将会自动地根据当前页面的侧边栏的顺序来获取。你也可以使用 `YAML front matter` 来明确地重写或者禁用它:
@@ -309,7 +327,7 @@ module.exports = {
309327
   docsDir: 'docs',
310328
   // 假如文档放在一个特定的分支下:
311329
   docsBranch: 'master',
312-
// 默认是 true, 设置为 false 来禁用
330+
// 默认是 false, 设置为 true 来启用
313331
editLinks: true,
314332
// 默认为 "Edit this page"
315333
editLinkText: '帮助我们改善此页面!'

0 commit comments

Comments
 (0)