Skip to content

Commit

Permalink
docs: some tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Mar 4, 2019
1 parent e5d8ed4 commit 75ab97d
Show file tree
Hide file tree
Showing 34 changed files with 85 additions and 68 deletions.
2 changes: 1 addition & 1 deletion packages/@vuepress/core/lib/node/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ module.exports = class App {

this.devProcess
.on('fileChanged', ({ type, target }) => {
console.log(`Reload due to ${chalk.red(type)} ${chalk.cyan(target)}`)
console.log(`Reload due to ${chalk.red(type)} ${chalk.cyan(path.relative(this.sourceDir, target))}`)
this.process()
})
.createServer()
Expand Down
1 change: 1 addition & 0 deletions packages/@vuepress/core/lib/node/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module.exports = class DevProcess extends EventEmitter {
*/

handleUpdate (type, target) {
logger.debug(type, target)
if (!path.isAbsolute(target)) {
target = path.join(this.context.sourceDir, target)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@vuepress/markdown-loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = function (src) {
|| headersChanged(cachedData.headers, headers)
)) {
// frontmatter changed... need to do a full reload
module.exports.frontmatterEmitter.emit('update')
module.exports.frontmatterEmitter.emit('update', file)
}

devCache.set(file, {
Expand Down
6 changes: 4 additions & 2 deletions packages/docs/docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ module.exports = ctx => ({
after: '</UpgradePath>',
}],
],
extraWatchFiles: [
'.vuepress/nav/en.js',
'.vuepress/nav/zh.js',
]
})

function getApiSidebar () {
return [
'',
'config',
'cli',
'node'
]
Expand Down
17 changes: 15 additions & 2 deletions packages/docs/docs/.vuepress/nav/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = [
link: '/guide/',
},
{
text: 'API',
link: '/api/'
text: 'Config Reference',
link: '/config/'
},
{
text: 'Plugin',
Expand All @@ -18,6 +18,19 @@ module.exports = [
{
text: 'Learn More',
items: [
{
text: 'API',
items: [
{
text: 'CLI',
link: '/api/cli.html'
},
{
text: 'Node',
link: '/api/node.html'
},
]
},
{
text: 'Contributing Guide',
items: [
Expand Down
17 changes: 15 additions & 2 deletions packages/docs/docs/.vuepress/nav/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = [
link: '/zh/guide/',
},
{
text: 'API',
link: '/zh/api/'
text: '配置',
link: '/zh/config/'
},
{
text: '插件',
Expand All @@ -18,6 +18,19 @@ module.exports = [
{
text: '了解更多',
items: [
{
text: 'API',
items: [
{
text: 'CLI',
link: '/zh/api/cli.html'
},
{
text: 'Node',
link: '/zh/api/node.html'
},
]
},
{
text: '开发指南',
items: [
Expand Down
7 changes: 0 additions & 7 deletions packages/docs/docs/api/README.md

This file was deleted.

8 changes: 4 additions & 4 deletions packages/docs/docs/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ vuepress <command> targetDir [options]
Build dir as a static site.

### -p, --port `<port>`
See [port](./config.md#port).
See [port](../config/README.md#port).

### -t, --temp `<temp>`
See [temp](./config.md#temp).
See [temp](../config/README.md#temp).

### -c, --cache [cache]
### -no--cache [cache]
See [cache](./config.md#cache).
See [cache](../config/README.md#cache).

### --debug
Start development server in debug mode.
Expand All @@ -31,7 +31,7 @@ Start development server in silent mode.
Start a development server. All options from `vuepress build` are available. And there are several options specifically for dev:

### --host `<host>`
See [host](../config.md#host).
See [host](../config/README.md#host).

### --open
Open browser when ready.
Expand Down
10 changes: 5 additions & 5 deletions packages/docs/docs/api/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ Specify the source directory for VuePress.

### options.theme

See [theme](../config.md#theme).
See [theme](../config/README.md#theme).

### options.plugins

See [plugins](../config.md#plugins).
See [plugins](../config/README.md#plugins).

### options.temp

See [temp](../config.md#temp).
See [temp](../config/README.md#temp).

### options.dest

See [dest](../config.md#dest).
See [dest](../config/README.md#dest).

### options.siteConfig

See [siteConfig](../config.md).
See [siteConfig](../config/README.md).
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
sidebarDepth: 3
sidebar: auto
---

# Config Reference
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docs/guide/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ In addition, you can use the `~` prefix to explicitly indicate this is a webpack
![Image from dependency](~some-dependency/image.png)
```

webpack aliases can be configured via [configureWebpack](../api/config.md#configurewebpack) in `.vuepress/config.js`. Example:
webpack aliases can be configured via [configureWebpack](../config/config.md#configurewebpack) in `.vuepress/config.js`. Example:

``` js
module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docs/guide/basic-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {

If you've got the dev server running, you should see the page now has a header with the title and a search box. VuePress comes with built-in headers-based search - it automatically builds a simple search index from the title, `h2` and `h3` headers from all the pages.

Consult the [Config Reference](../api/config.md) for a full list of options.
Consult the [Config Reference](../config/config.md) for a full list of options.

::: tip Alternative Config Formats
You can also use YAML (`.vuepress/config.yml`) or TOML (`.vuepress/config.toml`) formats for the configuration file.
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docs/guide/directory-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ For the above directory structure, the default page routing paths are as follows

**Also see:**

- [Config](../api/config.md)
- [Config](../config/config.md)
- [Theme](../theme/)
- [Default Theme Config](../theme/default-theme-config.md)

6 changes: 3 additions & 3 deletions packages/docs/docs/guide/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Header Anchors

Headers automatically get anchor links applied. Rendering of anchors can be configured using the [`markdown.anchor`](../api/config.md#markdown-anchor) option.
Headers automatically get anchor links applied. Rendering of anchors can be configured using the [`markdown.anchor`](../config/config.md#markdown-anchor) option.

## Links

Expand Down Expand Up @@ -53,7 +53,7 @@ Outbound links automatically gets `target="_blank" rel="noopener noreferrer"`:
- [vuejs.org](https://vuejs.org)
- [VuePress on GitHub](https://github.com/vuejs/vuepress)

You can customize the attributes added to external links by setting [config.markdown.externalLinks](../api/config.md#markdown-externallinks).
You can customize the attributes added to external links by setting [config.markdown.externalLinks](../config/config.md#markdown-externallinks).

## Front Matter

Expand Down Expand Up @@ -122,7 +122,7 @@ or

[[toc]]

Rendering of TOC can be configured using the [`markdown.toc`](../api/config.md#markdown-toc) option, or as props of [TOC component](./using-vue.md#toc), like `<TOC list-type="ol" :include-level="[2, Infinity]"/>`.
Rendering of TOC can be configured using the [`markdown.toc`](../config/config.md#markdown-toc) option, or as props of [TOC component](./using-vue.md#toc), like `<TOC list-type="ol" :include-level="[2, Infinity]"/>`.

## Custom Containers

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docs/guide/using-vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ yarn add -D pug pug-plain-loader
::: tip
If you are a Stylus user, you don't need to install `stylus` and `stylus-loader` in your project because VuePress uses Stylus internally.

For pre-processors that do not have built-in webpack config support, you will need to [extend the internal webpack config](../api/config.md#configurewebpack) in addition to installing the necessary dependencies.
For pre-processors that do not have built-in webpack config support, you will need to [extend the internal webpack config](../config/config.md#configurewebpack) in addition to installing the necessary dependencies.
:::

## Script & Style Hoisting
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/docs/miscellaneous/migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ See: [@vuepress/plugin-pwa > Migration from 0.x](../plugin/official/plugin-pwa.m
Replaced by `.vuepress/styles/palette.styl`.

::: upgrade
See: [Config > palette.styl](../api/config.md#palette-styl)
See: [Config > palette.styl](../config/config.md#palette-styl)
:::

### `.vuepress/style.styl` <Badge text="replaced"/>

Replaced by `.vuepress/styles/index.styl`.

::: upgrade
See: [Config > index.styl](../api/config.md#index-styl)
See: [Config > index.styl](../config/config.md#index-styl)
:::
2 changes: 1 addition & 1 deletion packages/docs/docs/plugin/context-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Output path.

- Type: `string`

See: [base](../api/config.md#base).
See: [base](../config/config.md#base).

## ctx.writeTemp

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docs/plugin/official/plugin-nprogress.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ $nprogressColor = red

**Also see:**

- [Config Reference > Styling](../../api/config.md#styling)
- [Config Reference > Styling](../../config/config.md#styling)
2 changes: 1 addition & 1 deletion packages/docs/docs/theme/default-theme-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ Note that it's `off` by default. If given a `string`, it will be displayed as a
The `themeConfig.serviceWorker` option allows you to configure the service worker.

::: tip
Please do not confuse this option with [Config > serviceWorker](../api/config.md#serviceworker), [Config > serviceWorker](../api/config.md#serviceworker) is **site-level**, while this option is **theme-level**.
Please do not confuse this option with [Config > serviceWorker](../config/config.md#serviceworker), [Config > serviceWorker](../config/config.md#serviceworker) is **site-level**, while this option is **theme-level**.
:::

### Popup UI to refresh contents <Badge text="0.13.0+"/> <Badge text="beta" type="warn"/>
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docs/theme/writing-a-theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The compiled content of the current `.md` file being rendered will be available

## Directory Structure

Just one `Layout.vue` might not be enough, and you might also want to define more layout components in the theme for using on different pages. You may also want to customize the [palette](../api/config.md#palette-styl), and even apply some plugins.
Just one `Layout.vue` might not be enough, and you might also want to define more layout components in the theme for using on different pages. You may also want to customize the [palette](../config/config.md#palette-styl), and even apply some plugins.

So it's time to reorganize your theme, an agreed theme directory structure is as follows:

Expand Down
7 changes: 0 additions & 7 deletions packages/docs/docs/zh/api/README.md

This file was deleted.

10 changes: 5 additions & 5 deletions packages/docs/docs/zh/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ vuepress <command> targetDir [options]
在指定的目录生成一个静态站点。

### -p, --port `<port>`
查看 [port](./config.md#port)
查看 [port](../config/README.md#port)

### -t, --temp `<temp>`
查看 [temp](./config.md#temp)
查看 [temp](../config/README.md#temp)

### -c, --cache [cache]
### -no--cache [cache]
查看 [cache](./config.md#cache)
查看 [cache](../config/README.md#cache)

### --debug
以调试模式启动开发服务器。
Expand All @@ -31,7 +31,7 @@ vuepress <command> targetDir [options]
启动一个开发服务器。来自 `vuepress build` 的所有选项都可用。除此以外,还有几个专门针对 dev 的选项:

### --host `<host>`
查看 [host](./config.md#host)
查看 [host](../config/README.md#host)

### --open
当服务端准备就绪时自动打开浏览器。
Expand All @@ -40,6 +40,6 @@ vuepress <command> targetDir [options]

将默认主题复制到 `.vuepress/theme` 目录,以供自定义。

## more commands
## 更多指令

你可以使用 [extendCli](../plugin/option-api.md#extendcli) 来创建自定义命令。
12 changes: 6 additions & 6 deletions packages/docs/docs/zh/api/node.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Node.js
# Node.js API

```js
const vuepress = require('vuepress')
Expand Down Expand Up @@ -38,20 +38,20 @@ app.process().then(() => {

### options.theme

查看 [theme](./config.md#theme)
查看 [theme](../config/README.md#theme)

### options.plugins

查看 [plugins](./config.md#plugins)
查看 [plugins](../config/README.md#plugins)

### options.temp

查看 [temp](./config.md#temp)
查看 [temp](../config/README.md#temp)

### options.dest

查看 [dest](./config.md#dest)
查看 [dest](../config/README.md#dest)

### options.siteConfig

查看 [siteConfig](./config.md)
查看 [siteConfig](../config/README.md)
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
sidebarDepth: 3
sidebar: auto
---

# 配置
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docs/zh/guide/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
![Image from dependency](~some-dependency/image.png)
```

Webpack 的别名可以通过 `.vuepress/config.js`[configureWebpack](../api/config.md#configurewebpack) 来配置,如:
Webpack 的别名可以通过 `.vuepress/config.js`[configureWebpack](../config/config.md#configurewebpack) 来配置,如:

``` js
module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docs/zh/guide/basic-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {

对于上述的配置,如果你运行起 dev server,你应该能看到一个页面,它包含一个页头,里面包含一个标题和一个搜索框。VuePress 内置了基于 headers 的搜索 —— 它会自动为所有页面的标题、`h2``h3` 构建起一个简单的搜索索引。

参见 [配置](../api/config.md) 来查看所有可配置的选项。
参见 [配置](../config/config.md) 来查看所有可配置的选项。

::: tip 其他配置格式
你也可以使用 YAML (`.vuepress/config.yml`) 或是 TOML (`.vuepress/config.toml`) 格式的配置文件。
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docs/zh/guide/directory-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ VuePress 遵循 **“约定优于配置”** 的原则,推荐的目录结构

**同时阅读:**

- [配置](../api/config.md)
- [配置](../config/config.md)
- [主题](../theme/README.md)
- [默认主题配置](../theme/default-theme-config.md)

Expand Down
Loading

0 comments on commit 75ab97d

Please sign in to comment.