From 5de419e297499d410032aa157be24d7127a03add Mon Sep 17 00:00:00 2001 From: ULIVZ <472590061@qq.com> Date: Sat, 29 Sep 2018 03:15:42 +0800 Subject: [PATCH 01/10] docs: fix typo --- packages/docs/docs/config/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/docs/config/README.md b/packages/docs/docs/config/README.md index 3ed0a3cf32..9f08cf67ed 100644 --- a/packages/docs/docs/config/README.md +++ b/packages/docs/docs/config/README.md @@ -199,7 +199,7 @@ Provide config options to the used theme. The options will vary depending on the For default usage, please refer to [plugin API](../plugin/README.md). ::: tip -There is a hidden feature. `.vuepress/config.js` also supports all [options](../plugin/README.md#options) plugin API. +There is a hidden feature. `.vuepress/config.js` also supports all [options](../plugin/README.md#options) of Plugin API. ::: ## Markdown From 3c430f892ef0e9f4aa7142517f43893828fcc02f Mon Sep 17 00:00:00 2001 From: ULIVZ <472590061@qq.com> Date: Sat, 29 Sep 2018 23:58:31 +0800 Subject: [PATCH 02/10] feat($markdown): support 'vue' container --- packages/@vuepress/markdown/lib/containers.js | 5 +++++ .../theme-default/styles/custom-blocks.styl | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/packages/@vuepress/markdown/lib/containers.js b/packages/@vuepress/markdown/lib/containers.js index 215c453491..0ee6be8037 100644 --- a/packages/@vuepress/markdown/lib/containers.js +++ b/packages/@vuepress/markdown/lib/containers.js @@ -11,6 +11,11 @@ module.exports = md => { ? `
`
+ : `
`
+ })
}
function createContainer (klass, defaultTitle) {
diff --git a/packages/@vuepress/theme-default/styles/custom-blocks.styl b/packages/@vuepress/theme-default/styles/custom-blocks.styl
index 3ccc2df2a2..830c144403 100644
--- a/packages/@vuepress/theme-default/styles/custom-blocks.styl
+++ b/packages/@vuepress/theme-default/styles/custom-blocks.styl
@@ -26,3 +26,15 @@
color darken(red, 40%)
a
color $textColor
+
+pre.vue-container
+ background-color: #f3f5f7 !important;
+ color: #2c3e50 !important;
+ border-left-width: .5rem;
+ border-left-style: solid;
+ border-color: #42b983;
+ code
+ color: #2c3e50 !important;
+ font-size: 14px !important;
+ & > p
+ margin: -20px 0;
From 86736e883a313e96b40e56807844546df9cd5a88 Mon Sep 17 00:00:00 2001
From: ULIVZ <472590061@qq.com>
Date: Sun, 30 Sep 2018 00:15:11 +0800
Subject: [PATCH 03/10] feat($core): change style convention
'.vuepress/style.styl' -> '.vuepress/styles/index.styl', i
'.vuepress/palette.styl' -> '.vuepress/styles/palette.styl'
---
.../core/lib/internal-plugins/palette/index.js | 2 +-
.../core/lib/internal-plugins/style/index.js | 14 +++-----------
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/packages/@vuepress/core/lib/internal-plugins/palette/index.js b/packages/@vuepress/core/lib/internal-plugins/palette/index.js
index 733264fd1c..b1b51b4db3 100644
--- a/packages/@vuepress/core/lib/internal-plugins/palette/index.js
+++ b/packages/@vuepress/core/lib/internal-plugins/palette/index.js
@@ -26,7 +26,7 @@ module.exports = (options, ctx) => ({
const themePalette = ctx.themePalette
const { palette: userPalette } = ctx.siteConfig
- const palettePath = path.resolve(sourceDir, '.vuepress/palette.styl')
+ const palettePath = path.resolve(sourceDir, '.vuepress/styles/palette.styl')
const themePaletteContent = resolvePaletteContent(themePalette)
const userPaletteContent = resolvePaletteContent(userPalette)
diff --git a/packages/@vuepress/core/lib/internal-plugins/style/index.js b/packages/@vuepress/core/lib/internal-plugins/style/index.js
index 8a8190ee3b..b28329e908 100644
--- a/packages/@vuepress/core/lib/internal-plugins/style/index.js
+++ b/packages/@vuepress/core/lib/internal-plugins/style/index.js
@@ -12,21 +12,13 @@ module.exports = (options, context) => ({
const hasUserOverride = fs.existsSync(overridePath)
if (hasUserOverride) {
- logger.tip(`${chalk.magenta('override.styl')} has been deprecated from v1.0.0, using ${chalk.cyan('config.palette')} instead.\n`)
+ logger.tip(`${chalk.magenta('override.styl')} has been deprecated from v1.0.0, using ${chalk.cyan('.vuepress/style/palette.styl')} instead.\n`)
}
// style.styl API.
- const stylePath = path.resolve(sourceDir, '.vuepress/style.styl')
+ const stylePath = path.resolve(sourceDir, '.vuepress/styles/index.styl')
const hasUserStyle = fs.existsSync(stylePath)
- await writeTemp('style.styl', hasUserStyle ? `@import(${JSON.stringify(stylePath)})` : ``)
-
- // Temporary tip, will be removed at next release.
- if (hasUserOverride && !hasUserStyle) {
- logger.tip(
- `${chalk.magenta('override.styl')} has been split into 2 APIs, we recommend you upgrade to continue.\n` +
- ` See: ${chalk.magenta('https://vuepress.vuejs.org/default-theme-config/#simple-css-override')}`
- )
- }
+ await writeTemp('style.styl', hasUserStyle ? `@import(${JSON.stringify(stylePath)})` : '')
}
})
From dd8ab89c4c8bcfb2bc25fdb1c980703abadf9d06 Mon Sep 17 00:00:00 2001
From: ULIVZ <472590061@qq.com>
Date: Sun, 30 Sep 2018 01:04:26 +0800
Subject: [PATCH 04/10] chore: styles dir test placeholder
---
packages/docs/docs/.vuepress/styles/index.styl | 5 +++++
packages/docs/docs/.vuepress/styles/palette.styl | 3 +++
2 files changed, 8 insertions(+)
create mode 100644 packages/docs/docs/.vuepress/styles/index.styl
create mode 100644 packages/docs/docs/.vuepress/styles/palette.styl
diff --git a/packages/docs/docs/.vuepress/styles/index.styl b/packages/docs/docs/.vuepress/styles/index.styl
new file mode 100644
index 0000000000..dcedb3b5cf
--- /dev/null
+++ b/packages/docs/docs/.vuepress/styles/index.styl
@@ -0,0 +1,5 @@
+// placeholder for test, dont't remove it.
+
+//.content {
+// font-size 30px;
+//}
diff --git a/packages/docs/docs/.vuepress/styles/palette.styl b/packages/docs/docs/.vuepress/styles/palette.styl
new file mode 100644
index 0000000000..94510b2978
--- /dev/null
+++ b/packages/docs/docs/.vuepress/styles/palette.styl
@@ -0,0 +1,3 @@
+// placeholder for test, dont't remove it.
+
+//$accentColor = #f00
From ae3bfb8a3ed0b997cf510aad44b6b91bfb82ee93 Mon Sep 17 00:00:00 2001
From: ULIVZ <472590061@qq.com>
Date: Sun, 30 Sep 2018 01:04:52 +0800
Subject: [PATCH 05/10] style: enhance the style of vue container
---
.../@vuepress/theme-default/styles/custom-blocks.styl | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/packages/@vuepress/theme-default/styles/custom-blocks.styl b/packages/@vuepress/theme-default/styles/custom-blocks.styl
index 830c144403..b383119bd7 100644
--- a/packages/@vuepress/theme-default/styles/custom-blocks.styl
+++ b/packages/@vuepress/theme-default/styles/custom-blocks.styl
@@ -33,8 +33,14 @@ pre.vue-container
border-left-width: .5rem;
border-left-style: solid;
border-color: #42b983;
- code
+ & > code
color: #2c3e50 !important;
font-size: 14px !important;
& > p
- margin: -20px 0;
+ margin: -5px 0 -20px 0;
+ code
+ background-color: darken(#f3f5f7, 10%) !important;
+ padding: 3px 5px;
+ border-radius: 10px;
+ color: lighten(#2c3e50, 10%) !important;
+
From 4cc317f2f22c412b41a636b534ec61fe4f13974f Mon Sep 17 00:00:00 2001
From: ULIVZ <472590061@qq.com>
Date: Sun, 30 Sep 2018 01:55:58 +0800
Subject: [PATCH 06/10] fix($pwa): z-index issue
---
packages/@vuepress/plugin-pwa/lib/SWUpdatePopup.vue | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/@vuepress/plugin-pwa/lib/SWUpdatePopup.vue b/packages/@vuepress/plugin-pwa/lib/SWUpdatePopup.vue
index f7d04aa716..b2e30bdcc5 100644
--- a/packages/@vuepress/plugin-pwa/lib/SWUpdatePopup.vue
+++ b/packages/@vuepress/plugin-pwa/lib/SWUpdatePopup.vue
@@ -86,6 +86,7 @@ export default {
background: #fff;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
text-align: center;
+ z-index: 2;
}
.sw-update-popup > button {
From b476ba4772b1e62a5cfef915da5794ff15dca16a Mon Sep 17 00:00:00 2001
From: ULIVZ <472590061@qq.com>
Date: Mon, 1 Oct 2018 16:49:08 +0800
Subject: [PATCH 07/10] docs: plugins documentation placeholder
---
packages/@vuepress/markdown/README.md | 39 ++++++++++++++++++-
.../@vuepress/plugin-back-to-top/README.md | 4 +-
packages/@vuepress/plugin-blog/README.md | 28 +++++++++++++
.../plugin-google-analytics/README.md | 8 ++++
packages/@vuepress/plugin-i18n-ui/README.md | 12 +++++-
.../@vuepress/plugin-last-updated/README.md | 8 ++++
.../@vuepress/plugin-medium-zoom/README.md | 10 ++++-
.../@vuepress/plugin-pagination/README.md | 29 ++++++++++++++
packages/@vuepress/plugin-pwa/README.md | 8 ++++
packages/@vuepress/plugin-search/README.md | 2 +-
packages/@vuepress/theme-default/README.md | 4 +-
11 files changed, 143 insertions(+), 9 deletions(-)
diff --git a/packages/@vuepress/markdown/README.md b/packages/@vuepress/markdown/README.md
index 5be9b185d7..048de75383 100644
--- a/packages/@vuepress/markdown/README.md
+++ b/packages/@vuepress/markdown/README.md
@@ -1,3 +1,40 @@
# @vuepress/markdown
-> markdown for vuepress
\ No newline at end of file
+> markdown for vuepress
+
+## Usage
+
+```javascript
+const createMarkdown = require('@vuepress/markdown')
+const md = createMarkdown(/* options */)
+```
+
+## Options
+
+### slugify
+
+- TODO
+
+### externalLinks
+
+- TODO
+
+### anchor
+
+- TODO
+
+### toc
+
+- TODO
+
+### lineNumbers
+
+- TODO
+
+### beforeInstantiate
+
+- TODO
+
+### afterInstantiate
+
+- TODO
diff --git a/packages/@vuepress/plugin-back-to-top/README.md b/packages/@vuepress/plugin-back-to-top/README.md
index 9e8260ae87..eee3173f60 100644
--- a/packages/@vuepress/plugin-back-to-top/README.md
+++ b/packages/@vuepress/plugin-back-to-top/README.md
@@ -6,10 +6,10 @@
```javascript
module.exports = {
- plugins: ['back-to-top']
+ plugins: ['@vuepress/back-to-top']
}
```
## Options
-No options for now.
\ No newline at end of file
+No options for now.
diff --git a/packages/@vuepress/plugin-blog/README.md b/packages/@vuepress/plugin-blog/README.md
index ed7755e68a..ecac370437 100644
--- a/packages/@vuepress/plugin-blog/README.md
+++ b/packages/@vuepress/plugin-blog/README.md
@@ -1,3 +1,31 @@
# @vuepress/plugin-blog
> theme plugin for vuepress
+
+## Usage
+
+```javascript
+module.exports = {
+ plugins: ['@vuepress/blog']
+}
+```
+
+## Options
+
+### pageEnhancers
+
+- Type: `function`
+- Default: `/i18n/`
+
+### categoryIndexPageUrl
+
+- Type: `string`
+- Default: `/category/`
+
+### tagIndexPageUrl
+
+- Type: `string`
+- Default: `/tag/`
+
+
+
diff --git a/packages/@vuepress/plugin-google-analytics/README.md b/packages/@vuepress/plugin-google-analytics/README.md
index be05a08e8b..624bf29328 100644
--- a/packages/@vuepress/plugin-google-analytics/README.md
+++ b/packages/@vuepress/plugin-google-analytics/README.md
@@ -2,6 +2,14 @@
> google-analytics plugin for vuepress
+## Usage
+
+```javascript
+module.exports = {
+ plugins: ['@vuepress/google-analytics']
+}
+```
+
## Options
### ga
diff --git a/packages/@vuepress/plugin-i18n-ui/README.md b/packages/@vuepress/plugin-i18n-ui/README.md
index f748c745b0..41410df10f 100644
--- a/packages/@vuepress/plugin-i18n-ui/README.md
+++ b/packages/@vuepress/plugin-i18n-ui/README.md
@@ -2,11 +2,19 @@
> i18n-ui plugin for vuepress
-## Plugin Options
+## Usage
+
+```javascript
+module.exports = {
+ plugins: ['@vuepress/i18n-ui']
+}
+```
+
+## Options
### route
- Type: `string`
- Default: `/i18n/`
-Path to the i18n ui page.
\ No newline at end of file
+Path to the i18n ui page.
diff --git a/packages/@vuepress/plugin-last-updated/README.md b/packages/@vuepress/plugin-last-updated/README.md
index e05d30bf6f..6211bf5572 100644
--- a/packages/@vuepress/plugin-last-updated/README.md
+++ b/packages/@vuepress/plugin-last-updated/README.md
@@ -4,6 +4,14 @@
> Note that this plugin has been included in the core.
+## Usage
+
+```js
+module.exports = {
+ plugins: ['@vuepress/last-updated']
+}
+```
+
## Options
### transformer
diff --git a/packages/@vuepress/plugin-medium-zoom/README.md b/packages/@vuepress/plugin-medium-zoom/README.md
index 89e7bf7a23..0fe70ff353 100644
--- a/packages/@vuepress/plugin-medium-zoom/README.md
+++ b/packages/@vuepress/plugin-medium-zoom/README.md
@@ -1,3 +1,11 @@
# @vuepress/plugin-medium-zoom
-> medium-zoom plugin for vuepress
\ No newline at end of file
+> medium-zoom plugin for vuepress
+
+## Usage
+
+```javascript
+module.exports = {
+ plugins: ['@vuepress/medium-zoom']
+}
+```
diff --git a/packages/@vuepress/plugin-pagination/README.md b/packages/@vuepress/plugin-pagination/README.md
index a4eabe695e..2e2f2f3981 100644
--- a/packages/@vuepress/plugin-pagination/README.md
+++ b/packages/@vuepress/plugin-pagination/README.md
@@ -2,3 +2,32 @@
> pagination plugin for vuepress
+## Usage
+
+```javascript
+module.exports = {
+ plugins: ['@vuepress/pagination']
+}
+```
+
+## postsFilter
+
+- Type: `function`
+- Default:
+
+```js
+(({ type }) => type === 'post')`
+```
+
+## postsSorter
+
+- Type: `function`
+- Default:
+
+```js
+((prev, next) => {
+ const prevTime = new Date(prev.frontmatter.date).getTime()
+ const nextTime = new Date(next.frontmatter.date).getTime()
+ return prevTime - nextTime > 0 ? -1 : 1
+})
+```
diff --git a/packages/@vuepress/plugin-pwa/README.md b/packages/@vuepress/plugin-pwa/README.md
index 9939adfad4..c7987088dd 100644
--- a/packages/@vuepress/plugin-pwa/README.md
+++ b/packages/@vuepress/plugin-pwa/README.md
@@ -2,6 +2,14 @@
> PWA plugin for vuepress
+## Usage
+
+```javascript
+module.exports = {
+ plugins: ['@vuepress/pwa']
+}
+```
+
## Options
### serviceWorker
diff --git a/packages/@vuepress/plugin-search/README.md b/packages/@vuepress/plugin-search/README.md
index 98f77fcfb5..d6d175cb0b 100644
--- a/packages/@vuepress/plugin-search/README.md
+++ b/packages/@vuepress/plugin-search/README.md
@@ -39,4 +39,4 @@ import SearchBox from '@SearchBox'
- Type: `number`
- Default: `true`
-Set the maximum number of results for search
+Set the maximum number of results for search.
diff --git a/packages/@vuepress/theme-default/README.md b/packages/@vuepress/theme-default/README.md
index ea4d09cd78..0922de154a 100644
--- a/packages/@vuepress/theme-default/README.md
+++ b/packages/@vuepress/theme-default/README.md
@@ -6,5 +6,5 @@
The default theme has the following plugin built in:
-- @vuepress/plugin-active-header-links
-- @vuepress/plugin-google-analytics
\ No newline at end of file
+- [@vuepress/plugin-active-header-links](https://github.com/vuejs/vuepress/tree/master/packages/@vuepress/plugin-active-header-links)
+- [@vuepress/plugin-google-analytics](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/plugin-google-analytics)
From f6bb4145e6c0bbe3af7335aee31fc57bcbb42cf8 Mon Sep 17 00:00:00 2001
From: ULIVZ <472590061@qq.com>
Date: Thu, 4 Oct 2018 05:35:14 +0800
Subject: [PATCH 08/10] feat($core): custom data block
---
.../lib/internal-plugins/dataBlock/index.js | 26 +++++++++++++++++++
.../lib/internal-plugins/dataBlock/loader.js | 9 +++++++
.../@vuepress/core/lib/prepare/AppContext.js | 1 +
3 files changed, 36 insertions(+)
create mode 100644 packages/@vuepress/core/lib/internal-plugins/dataBlock/index.js
create mode 100644 packages/@vuepress/core/lib/internal-plugins/dataBlock/loader.js
diff --git a/packages/@vuepress/core/lib/internal-plugins/dataBlock/index.js b/packages/@vuepress/core/lib/internal-plugins/dataBlock/index.js
new file mode 100644
index 0000000000..d5198d5dc5
--- /dev/null
+++ b/packages/@vuepress/core/lib/internal-plugins/dataBlock/index.js
@@ -0,0 +1,26 @@
+module.exports = () => ({
+ name: '@vuepress/internal-data-block',
+
+ chainWebpack (config) {
+ config
+ .module
+ .rule('data-block')
+ .resourceQuery(/blockType=data/)
+ .use('date-block-loader')
+ .loader(require.resolve('./loader.js'))
+ },
+
+ enhanceAppFiles () {
+ return [{
+ name: 'data-block',
+ content: `
+ export default ({ Vue }) => { Vue.mixin({
+ computed: {
+ $dataBlock() {
+ return this.$options.__data__block__
+ }
+ }
+ }) }`.trim()
+ }]
+ }
+})
diff --git a/packages/@vuepress/core/lib/internal-plugins/dataBlock/loader.js b/packages/@vuepress/core/lib/internal-plugins/dataBlock/loader.js
new file mode 100644
index 0000000000..9a19ee73b6
--- /dev/null
+++ b/packages/@vuepress/core/lib/internal-plugins/dataBlock/loader.js
@@ -0,0 +1,9 @@
+module.exports = function (source, map) {
+ this.callback(
+ null,
+ `export default function (Component) {
+ Component.options.__data__block__ = ${source.trim()}
+ }`,
+ map
+ )
+}
diff --git a/packages/@vuepress/core/lib/prepare/AppContext.js b/packages/@vuepress/core/lib/prepare/AppContext.js
index 157e87d44b..790fa08b58 100644
--- a/packages/@vuepress/core/lib/prepare/AppContext.js
+++ b/packages/@vuepress/core/lib/prepare/AppContext.js
@@ -115,6 +115,7 @@ module.exports = class AppContext {
.use(require('../internal-plugins/layoutComponents'))
.use(require('../internal-plugins/pageComponents'))
.use(require('../internal-plugins/transformModule'))
+ .use(require('../internal-plugins/dataBlock'))
// user plugin
.useByPluginsConfig(this.cliOptions.plugins)
.useByPluginsConfig(this.siteConfig.plugins)
From 903138e839d0be8970584fa0f78f112442c0b0a3 Mon Sep 17 00:00:00 2001
From: ULIVZ <472590061@qq.com>
Date: Thu, 4 Oct 2018 06:21:17 +0800
Subject: [PATCH 09/10] feat($markdown): support pass in block data at compile
time
---
packages/@vuepress/markdown-loader/index.js | 5 +++--
packages/@vuepress/markdown/lib/hoist.js | 2 +-
packages/@vuepress/markdown/lib/index.js | 14 ++++++++++++--
packages/@vuepress/markdown/lib/link.js | 4 ++--
4 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/packages/@vuepress/markdown-loader/index.js b/packages/@vuepress/markdown-loader/index.js
index 7d58ce5fac..60c9992946 100644
--- a/packages/@vuepress/markdown-loader/index.js
+++ b/packages/@vuepress/markdown-loader/index.js
@@ -66,7 +66,7 @@ module.exports = function (src) {
// the render method has been augmented to allow plugins to
// register data during render
- const { html, data: { hoistedTags, links }} = markdown.render(content)
+ const { html, data: { hoistedTags, links }, dataBlockString } = markdown.render(content)
// check if relative links are valid
links && links.forEach(link => {
@@ -102,7 +102,8 @@ module.exports = function (src) {
`\n` +
`