From 1e2d4d5bded2f70ba2d41b149c08a99e531ae2af Mon Sep 17 00:00:00 2001 From: Eko Eryanto Date: Fri, 5 Oct 2018 17:30:22 +0700 Subject: [PATCH] docs: update link to master branch (#890) --- packages/docs/docs/guide/README.md | 2 +- packages/docs/docs/plugin/README.md | 40 ++++++++++++++--------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/docs/docs/guide/README.md b/packages/docs/docs/guide/README.md index 5551339e..14475b26 100644 --- a/packages/docs/docs/guide/README.md +++ b/packages/docs/docs/guide/README.md @@ -2,7 +2,7 @@ -VuePress is composed of two parts: a [minimalistic static site generator](https://github.com/vuejs/vuepress/tree/next/packages/%40vuepress/core) with a Vue-powered theming system and [Plugin API](../plugin/README.md), and a [default theme](../default-theme-config/README.md) optimized for writing technical documentation. It was created to support the documentation needs of Vue's own sub projects. +VuePress is composed of two parts: a [minimalistic static site generator](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/core) with a Vue-powered theming system and [Plugin API](../plugin/README.md), and a [default theme](../default-theme-config/README.md) optimized for writing technical documentation. It was created to support the documentation needs of Vue's own sub projects. Each page generated by VuePress has its own pre-rendered static HTML, providing great loading performance and is SEO-friendly. Once the page is loaded, however, Vue takes over the static content and turns it into a full Single-Page Application (SPA). Additional pages are fetched on demand as the user navigates around the site. diff --git a/packages/docs/docs/plugin/README.md b/packages/docs/docs/plugin/README.md index 2f60667d..78b9d931 100644 --- a/packages/docs/docs/plugin/README.md +++ b/packages/docs/docs/plugin/README.md @@ -8,10 +8,10 @@ sidebar: auto Plugins usually add global-level functionality to VuePress. There is no strictly defined scope for a plugin - there are typically several types of plugins: -1. Extend the data generated at compile time. e.g. [@vuepress/plugin-last-updated](https://github.com/vuejs/vuepress/tree/next/packages/@vuepress/plugin-last-updated). -2. Generate extra files before or after compilation. e.g. [@vuepress/plugin-pwa](https://github.com/vuejs/vuepress/tree/next/packages/%40vuepress/plugin-pwa) -3. Add extra pages. e.g. [@vuepress/plugin-i18n-ui](https://github.com/vuejs/vuepress/tree/next/packages/@vuepress/plugin-i18n-ui) -4. Inject global UI. e.g. [@vuepress/plugin-back-to-top](https://github.com/vuejs/vuepress/tree/next/packages/%40vuepress/plugin-back-to-top). +1. Extend the data generated at compile time. e.g. [@vuepress/plugin-last-updated](https://github.com/vuejs/vuepress/tree/master/packages/@vuepress/plugin-last-updated). +2. Generate extra files before or after compilation. e.g. [@vuepress/plugin-pwa](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/plugin-pwa) +3. Add extra pages. e.g. [@vuepress/plugin-i18n-ui](https://github.com/vuejs/vuepress/tree/master/packages/@vuepress/plugin-i18n-ui) +4. Inject global UI. e.g. [@vuepress/plugin-back-to-top](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/plugin-back-to-top). A plugin should export a `plain object`(`#1`). If the plugin needs to take options, it can be a function that exports a plain object(`#2`). The function will be called with the plugin's options as the first argument, along with [context](#plugin-context) which provides some compile-time metadata. @@ -42,7 +42,7 @@ You can use plugins by doing some configuration at `.vuepress/config.js`: ``` js module.exports = { plugins: [ - require('./my-plugin.js') + require('./my-plugin.js') ] } ``` @@ -121,7 +121,7 @@ VuePress also provides a simpler way to use plugins from a dependency: ``` js module.exports = { plugins: { - 'xxx': { /* options */ } + 'xxx': { /* options */ } } } ``` @@ -133,7 +133,7 @@ The plugin can be disabled when `false` is explicitly passed as option. ``` js module.exports = { - plugins: [ + plugins: [ [ 'xxx', false ] // disabled. ] } @@ -158,7 +158,7 @@ module.exports = { - Type: `string` - Default: undefined -The name of the plugin. +The name of the plugin. Internally, vuepress will use the plugin's package name as the plugin name. When your plugin is a local plugin (i.e. using a pure plugin function directly), please be sure to configure this option, that is good for debug tracking. @@ -206,9 +206,9 @@ module.exports = { ``` ::: tip -Since VuePress is a Vue-SSR based application, there will be two webpack configurations, `isServer` is used to determine whether the current webpack config is applied to the server or client. +Since VuePress is a Vue-SSR based application, there will be two webpack configurations, `isServer` is used to determine whether the current webpack config is applied to the server or client. -**Also see:** +**Also see:** - [Vue SSR > Build Configuration](https://ssr.vuejs.org/guide/build-config.html) ::: @@ -228,7 +228,7 @@ module.exports = { SW_BASE_URL: JSON.stringify('/') }) ]) - } + } } ``` @@ -268,7 +268,7 @@ We can set aliases via [chainWebpack](chainwebpack): module.exports = (options, ctx) => ({ chainWebpack (config) { config.resolve.alias.set('@theme', ctx.themePath) - } + } }) ``` @@ -304,7 +304,7 @@ const path = require('path') module.exports = (options, ctx) => { const imagesAssetsPath = path.resolve(ctx.sourceDir, '.vuepress/images') - + return { // For development enhanceDevServer (app) { @@ -355,25 +355,25 @@ module.exports = { .link(true) .breaks(true) - // Modify the arguments of internal plugin. + // Modify the arguments of internal plugin. config .plugin('anchor') .tap(([options]) => [ Object.assign(options, { permalinkSymbol: '#' }) ]) - + // Add extra markdown-it plugin config .plugin('sup') .add(require('markdown-it-sup')) - - // Remove internal plugin + + // Remove internal plugin config.plugins.delete('snippet') } } ``` -**Also see:** +**Also see:** - [Internal plugins in VuePress](https://github.com/vuejs/vuepress/blob/next/packages/%40vuepress/core/lib/markdown/index.js) - [Config plugins](https://github.com/neutrinojs/webpack-chain#config-plugins) @@ -531,7 +531,7 @@ Add a page with explicit content: ```js module.exports = { async additionalPages () { - const rp = require('request-promise'); + const rp = require('request-promise'); // VuePress doesn't have request library built-in // you need to install it yourself. @@ -591,7 +591,7 @@ Then, VuePress will automatically inject these components behind the theme conta ## Context -Starting with VuePress 1.x.x, VuePress provides an `AppContext` object that stores all the state of the current app and can be accessed through the plugin API. +Starting with VuePress 1.x.x, VuePress provides an `AppContext` object that stores all the state of the current app and can be accessed through the plugin API. ::: warning Note Context of each plugin is a isolated context, they just inherit from the same app context.