diff --git a/CHANGELOG.md b/CHANGELOG.md index 650c7202b3..b2130cf407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [1.7.1](https://github.com/vuejs/vuepress/compare/v1.7.0...v1.7.1) (2020-10-15) + + +### Bug Fixes + +* **$core:** add missing styles for OutboundLink ([#2662](https://github.com/vuejs/vuepress/issues/2662)) ([e2b6641](https://github.com/vuejs/vuepress/commit/e2b6641)) +* **$core:** reference correct canonical Url frontmatter property (fix [#2665](https://github.com/vuejs/vuepress/issues/2665)) ([fbf5e5d](https://github.com/vuejs/vuepress/commit/fbf5e5d)) + + + # [1.7.0](https://github.com/vuejs/vuepress/compare/v1.6.0...v1.7.0) (2020-10-13) diff --git a/README.md b/README.md index 90fedf1731..680414de4f 100644 --- a/README.md +++ b/README.md @@ -11,22 +11,7 @@ VuePress channel on Discord

-## Install - -### Package - -```bash -yarn add vuepress -D -``` - -### Generator - -```bash -# Creates a scaffolded docs site -yarn create vuepress-site -``` - -For more information, see [create-vuepress-site](https://github.com/vuepressjs/create-vuepress-site). +> VuePress 2 is coming! Please check out [vuepress-next](https://github.com/vuepress/vuepress-next). ## Documentation diff --git a/lerna.json b/lerna.json index 1b303036c7..665c180727 100644 --- a/lerna.json +++ b/lerna.json @@ -1,7 +1,7 @@ { "npmClient": "yarn", "useWorkspaces": true, - "version": "1.7.1", + "version": "1.8.0", "command": { "version": { "allowBranch": "master", diff --git a/packages/@vuepress/core/lib/node/createTemp.js b/packages/@vuepress/core/lib/node/createTemp.js index 96b831e349..8f20207cb9 100644 --- a/packages/@vuepress/core/lib/node/createTemp.js +++ b/packages/@vuepress/core/lib/node/createTemp.js @@ -1,5 +1,15 @@ const { fs, path, chalk, logger } = require('@vuepress/shared-utils') +// Only empty the `.temp` directory at most once per run to avoid +// compilation errors caused by removed files. +// See: https://github.com/vuejs/vuepress/issues/2254#issuecomment-689457157 +// +// Known issue: This can cause the `.temp` directory to grow while the server +// is running, but the impact is limited because the `.temp` directory will +// be cleared when restarting the server. +// See discussion in https://github.com/vuejs/vuepress/pull/2612 +let alreadyEmptied = false + /** * Create a dynamic temp utility context that allow to lanuch * multiple apps with isolated context at the same time. @@ -19,8 +29,9 @@ module.exports = function createTemp (tempPath) { if (!fs.existsSync(tempPath)) { fs.ensureDirSync(tempPath) - } else { + } else if (!alreadyEmptied) { fs.emptyDirSync(tempPath) + alreadyEmptied = true } logger.debug(`Temp directory: ${chalk.gray(tempPath)}`) diff --git a/packages/@vuepress/core/package.json b/packages/@vuepress/core/package.json index d67188b115..4fd3635362 100644 --- a/packages/@vuepress/core/package.json +++ b/packages/@vuepress/core/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/core", - "version": "1.7.1", + "version": "1.8.0", "description": "Minimalistic doc generator with Vue component based layout system", "keywords": [ "documentation", @@ -25,11 +25,11 @@ "dependencies": { "@babel/core": "^7.8.4", "@vue/babel-preset-app": "^4.1.2", - "@vuepress/markdown": "1.7.1", - "@vuepress/markdown-loader": "1.7.1", - "@vuepress/plugin-last-updated": "1.7.1", - "@vuepress/plugin-register-components": "1.7.1", - "@vuepress/shared-utils": "1.7.1", + "@vuepress/markdown": "1.8.0", + "@vuepress/markdown-loader": "1.8.0", + "@vuepress/plugin-last-updated": "1.8.0", + "@vuepress/plugin-register-components": "1.8.0", + "@vuepress/shared-utils": "1.8.0", "autoprefixer": "^9.5.1", "babel-loader": "^8.0.4", "cache-loader": "^3.0.0", diff --git a/packages/@vuepress/markdown-loader/package.json b/packages/@vuepress/markdown-loader/package.json index 708e8862f7..cd66cf3af6 100644 --- a/packages/@vuepress/markdown-loader/package.json +++ b/packages/@vuepress/markdown-loader/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/markdown-loader", - "version": "1.7.1", + "version": "1.8.0", "description": "markdown-loader for vuepress", "keywords": [ "documentation", @@ -21,7 +21,7 @@ "author": "Evan You", "main": "index.js", "dependencies": { - "@vuepress/markdown": "1.7.1", + "@vuepress/markdown": "1.8.0", "loader-utils": "^1.1.0", "lru-cache": "^5.1.1" }, diff --git a/packages/@vuepress/markdown/__tests__/link.spec.js b/packages/@vuepress/markdown/__tests__/link.spec.js index ee144bc16d..410084277d 100644 --- a/packages/@vuepress/markdown/__tests__/link.spec.js +++ b/packages/@vuepress/markdown/__tests__/link.spec.js @@ -2,12 +2,19 @@ import { Md } from './util' import link from '../lib/link.js' import { dataReturnable } from '../index.js' -const mdL = Md().use(link, { +const EXTERNAL_ATTRS = { target: '_blank', rel: 'noopener noreferrer' -}) +} + +const setup = ({ externalAttrs = EXTERNAL_ATTRS, suffix } = {}) => { + const mdL = Md().use(link, EXTERNAL_ATTRS, suffix) + dataReturnable(mdL) -dataReturnable(mdL) + return mdL +} + +const mdL = setup() const internalLinkAsserts = { // START absolute path usage @@ -69,6 +76,21 @@ describe('link', () => { expect(html).toMatchSnapshot() } }) + + test('with custom page suffix should render links correctly', () => { + const suffix = '/' + const mdLSuffix = setup({ suffix }) + + for (const before in internalLinkAsserts) { + const input = `[${before}](${before})` + const output = mdLSuffix.render(input) + const after = getCompiledLink(output) + const value = internalLinkAsserts[before] + const isHtmlLink = value === before + const expected = isHtmlLink ? value : value.replace('.html', suffix) + expect(after).toBe(expected) + } + }) }) function getCompiledLink (output) { diff --git a/packages/@vuepress/markdown/index.js b/packages/@vuepress/markdown/index.js index fae5948ab4..3635359efa 100644 --- a/packages/@vuepress/markdown/index.js +++ b/packages/@vuepress/markdown/index.js @@ -31,6 +31,7 @@ const { module.exports = (markdown = {}) => { const { externalLinks, + pageSuffix, anchor, toc, plugins, @@ -73,7 +74,7 @@ module.exports = (markdown = {}) => { .use(convertRouterLinkPlugin, [Object.assign({ target: '_blank', rel: 'noopener noreferrer' - }, externalLinks)]) + }, externalLinks), pageSuffix]) .end() .plugin(PLUGINS.HOIST_SCRIPT_STYLE) diff --git a/packages/@vuepress/markdown/lib/link.js b/packages/@vuepress/markdown/lib/link.js index 064aa7ae40..9cd84170ae 100644 --- a/packages/@vuepress/markdown/lib/link.js +++ b/packages/@vuepress/markdown/lib/link.js @@ -6,7 +6,7 @@ const url = require('url') const indexRE = /(^|.*\/)(index|readme).md(#?.*)$/i -module.exports = (md, externalAttrs) => { +module.exports = (md, externalAttrs, pageSuffix = '.html') => { let hasOpenRouterLink = false let hasOpenExternalLink = false @@ -28,13 +28,13 @@ module.exports = (md, externalAttrs) => { } } else if (isSourceLink) { hasOpenRouterLink = true - tokens[idx] = toRouterLink(token, link, relativePath) + tokens[idx] = toRouterLink(token, link, relativePath, pageSuffix) } } return self.renderToken(tokens, idx, options) } - function toRouterLink (token, link, relativePath) { + function toRouterLink (token, link, relativePath, suffix) { link[0] = 'to' let to = link[1] @@ -55,8 +55,8 @@ module.exports = (md, externalAttrs) => { to = path + hash } else { to = to - .replace(/\.md$/, '.html') - .replace(/\.md(#.*)$/, '.html$1') + .replace(/\.md$/, suffix) + .replace(/\.md(#.*)$/, `${suffix}$1`) } // markdown-it encodes the uri diff --git a/packages/@vuepress/markdown/package.json b/packages/@vuepress/markdown/package.json index e0a421efd6..75828f0f39 100644 --- a/packages/@vuepress/markdown/package.json +++ b/packages/@vuepress/markdown/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/markdown", - "version": "1.7.1", + "version": "1.8.0", "description": "markdown for vuepress", "keywords": [ "documentation", @@ -22,7 +22,7 @@ "author": "Evan You", "main": "index.js", "dependencies": { - "@vuepress/shared-utils": "1.7.1", + "@vuepress/shared-utils": "1.8.0", "markdown-it": "^8.4.1", "markdown-it-anchor": "^5.0.2", "markdown-it-chain": "^1.3.0", diff --git a/packages/@vuepress/plugin-active-header-links/package.json b/packages/@vuepress/plugin-active-header-links/package.json index 351eb9b786..6d07b275c1 100644 --- a/packages/@vuepress/plugin-active-header-links/package.json +++ b/packages/@vuepress/plugin-active-header-links/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-active-header-links", - "version": "1.7.1", + "version": "1.8.0", "description": "active-header-links plugin for vuepress", "keywords": [ "documentation", diff --git a/packages/@vuepress/plugin-back-to-top/package.json b/packages/@vuepress/plugin-back-to-top/package.json index 36d499e702..786860c2a2 100644 --- a/packages/@vuepress/plugin-back-to-top/package.json +++ b/packages/@vuepress/plugin-back-to-top/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-back-to-top", - "version": "1.7.1", + "version": "1.8.0", "description": "back-to-top plugin for vuepress", "keywords": [ "documentation", diff --git a/packages/@vuepress/plugin-google-analytics/enhanceAppFile.js b/packages/@vuepress/plugin-google-analytics/enhanceAppFile.js index 6762d48e45..37475ea33b 100644 --- a/packages/@vuepress/plugin-google-analytics/enhanceAppFile.js +++ b/packages/@vuepress/plugin-google-analytics/enhanceAppFile.js @@ -20,7 +20,7 @@ export default ({ router }) => { ga('set', 'anonymizeIp', true) router.afterEach(function (to) { - ga('set', 'page', to.fullPath) + ga('set', 'page', router.app.$withBase(to.fullPath)) ga('send', 'pageview') }) } diff --git a/packages/@vuepress/plugin-google-analytics/package.json b/packages/@vuepress/plugin-google-analytics/package.json index 4f4c50c0c8..9fe2c43eef 100644 --- a/packages/@vuepress/plugin-google-analytics/package.json +++ b/packages/@vuepress/plugin-google-analytics/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-google-analytics", - "version": "1.7.1", + "version": "1.8.0", "description": "google-analytics plugin for vuepress", "keywords": [ "documentation", diff --git a/packages/@vuepress/plugin-last-updated/package.json b/packages/@vuepress/plugin-last-updated/package.json index 147c68abf4..11a5e418a8 100644 --- a/packages/@vuepress/plugin-last-updated/package.json +++ b/packages/@vuepress/plugin-last-updated/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-last-updated", - "version": "1.7.1", + "version": "1.8.0", "description": "last-updated plugin for vuepress", "keywords": [ "documentation", diff --git a/packages/@vuepress/plugin-medium-zoom/package.json b/packages/@vuepress/plugin-medium-zoom/package.json index f021b15e29..3c2d2009b3 100644 --- a/packages/@vuepress/plugin-medium-zoom/package.json +++ b/packages/@vuepress/plugin-medium-zoom/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-medium-zoom", - "version": "1.7.1", + "version": "1.8.0", "description": "medium-zoom plugin for vuepress", "keywords": [ "documentation", diff --git a/packages/@vuepress/plugin-nprogress/package.json b/packages/@vuepress/plugin-nprogress/package.json index cea999aa6f..0b273dc1b3 100644 --- a/packages/@vuepress/plugin-nprogress/package.json +++ b/packages/@vuepress/plugin-nprogress/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-nprogress", - "version": "1.7.1", + "version": "1.8.0", "description": "nprogress plugin for vuepress", "keywords": [ "documentation", diff --git a/packages/@vuepress/plugin-pwa/package.json b/packages/@vuepress/plugin-pwa/package.json index 9850ceb1dd..8b065055a7 100644 --- a/packages/@vuepress/plugin-pwa/package.json +++ b/packages/@vuepress/plugin-pwa/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-pwa", - "version": "1.7.1", + "version": "1.8.0", "description": "pwa plugin for vuepress", "keywords": [ "documentation", @@ -21,7 +21,7 @@ "author": "ULIVZ ", "main": "index.js", "dependencies": { - "@vuepress/shared-utils": "1.7.1", + "@vuepress/shared-utils": "1.8.0", "register-service-worker": "^1.7.0", "workbox-build": "^4.3.1" }, diff --git a/packages/@vuepress/plugin-register-components/package.json b/packages/@vuepress/plugin-register-components/package.json index b7d4460dbe..d8aedf01f4 100644 --- a/packages/@vuepress/plugin-register-components/package.json +++ b/packages/@vuepress/plugin-register-components/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-register-components", - "version": "1.7.1", + "version": "1.8.0", "description": "register-global-components plugin for vuepress", "keywords": [ "documentation", @@ -21,7 +21,7 @@ "author": "ULIVZ ", "main": "index.js", "dependencies": { - "@vuepress/shared-utils": "1.7.1" + "@vuepress/shared-utils": "1.8.0" }, "publishConfig": { "access": "public" diff --git a/packages/@vuepress/plugin-search/package.json b/packages/@vuepress/plugin-search/package.json index 742375fc93..a563647582 100644 --- a/packages/@vuepress/plugin-search/package.json +++ b/packages/@vuepress/plugin-search/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-search", - "version": "1.7.1", + "version": "1.8.0", "description": "search plugin for vuepress", "keywords": [ "documentation", diff --git a/packages/@vuepress/shared-utils/__tests__/parseHeaders.spec.ts b/packages/@vuepress/shared-utils/__tests__/parseHeaders.spec.ts index 60ffc7afc0..aaa487a215 100644 --- a/packages/@vuepress/shared-utils/__tests__/parseHeaders.spec.ts +++ b/packages/@vuepress/shared-utils/__tests__/parseHeaders.spec.ts @@ -19,6 +19,10 @@ describe('parseHeaders', () => { '\\*vue\\*': '*vue*', '\\!vue\\!': '!vue!', + // #2688 + '[vue](vuejs.org) / [vue](vuejs.org)': 'vue / vue', + '[\\](vuejs.org)': '', + // #564 For multiple markdown tokens '`a` and `b`': 'a and b', '***bold and italic***': 'bold and italic', diff --git a/packages/@vuepress/shared-utils/__tests__/removeNonCodeWrappedHTML.spec.ts b/packages/@vuepress/shared-utils/__tests__/removeNonCodeWrappedHTML.spec.ts index cfa2594a92..cd80803d3e 100644 --- a/packages/@vuepress/shared-utils/__tests__/removeNonCodeWrappedHTML.spec.ts +++ b/packages/@vuepress/shared-utils/__tests__/removeNonCodeWrappedHTML.spec.ts @@ -44,7 +44,10 @@ test('removeNonCodeWrappedHTML', () => { '# H1 `` H2': '# H1 `` H2', '# H1 `` H2': '# H1 `` H2', '# H1 `` H2': '# H1 `` H2', - '# H1 `` H2': '# H1 `` H2' + '# H1 `` H2': '# H1 `` H2', + + // #2688 + '# \\': '# \\' } Object.keys(asserts).forEach(input => { diff --git a/packages/@vuepress/shared-utils/package.json b/packages/@vuepress/shared-utils/package.json index 38d0cbf56e..7d85804e8a 100644 --- a/packages/@vuepress/shared-utils/package.json +++ b/packages/@vuepress/shared-utils/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/shared-utils", - "version": "1.7.1", + "version": "1.8.0", "description": "shared-utils for vuepress", "keywords": [ "documentation", diff --git a/packages/@vuepress/shared-utils/src/parseHeaders.ts b/packages/@vuepress/shared-utils/src/parseHeaders.ts index 2665b6c29b..5be50751b1 100644 --- a/packages/@vuepress/shared-utils/src/parseHeaders.ts +++ b/packages/@vuepress/shared-utils/src/parseHeaders.ts @@ -15,9 +15,9 @@ import parseEmojis from './parseEmojis' // wrapped by (markdown token: '`') tag. const removeMarkdownTokens = (str: string): string => String(str) - .replace(/\[(.*)\]\(.*\)/, '$1') // []() - .replace(/(`|\*{1,3}|_)(.*?[^\\])\1/g, '$2') // `{t}` | *{t}* | **{t}** | ***{t}*** | _{t}_ - .replace(/(\\)(\*|_|`|\!)/g, '$2') // remove escape char '\' + .replace(/(\[(.[^\]]+)\]\((.[^)]+)\))/g, '$2') // []() + .replace(/(`|\*{1,3}|_)(.*?[^\\])\1/g, '$2') // `{t}` | *{t}* | **{t}** | ***{t}*** | _{t}_ + .replace(/(\\)(\*|_|`|\!|<)/g, '$2') // remove escape char '\' const trim = (str: string): string => str.trim() diff --git a/packages/@vuepress/shared-utils/src/removeNonCodeWrappedHTML.ts b/packages/@vuepress/shared-utils/src/removeNonCodeWrappedHTML.ts index 7d5461b80c..270a4f102d 100644 --- a/packages/@vuepress/shared-utils/src/removeNonCodeWrappedHTML.ts +++ b/packages/@vuepress/shared-utils/src/removeNonCodeWrappedHTML.ts @@ -3,5 +3,5 @@ // Input: " b", Output: "b" // Input: "`` b", Output: "`` b" export = function removeNonCodeWrappedHTML (str: string): string { - return String(str).replace(/(^|[^><`])<.*>([^><`]|$)/g, '$1$2') + return String(str).replace(/(^|[^><`\\])<.*>([^><`]|$)/g, '$1$2') } diff --git a/packages/@vuepress/test-utils/package.json b/packages/@vuepress/test-utils/package.json index d9d68f3048..4d04a55f8f 100644 --- a/packages/@vuepress/test-utils/package.json +++ b/packages/@vuepress/test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/test-utils", - "version": "1.7.1", + "version": "1.8.0", "description": "test-utils for vuepress", "keywords": [ "documentation", @@ -25,8 +25,8 @@ "@babel/preset-env": "^7.0.0", "@types/jest": "^24.0.9", "@vue/test-utils": "^1.0.0-beta.29", - "@vuepress/core": "1.7.1", - "@vuepress/shared-utils": "1.7.1", + "@vuepress/core": "1.8.0", + "@vuepress/shared-utils": "1.8.0", "babel-jest": "^24.7.1", "execa": "^1.0.0", "jest": "^24.7.1", diff --git a/packages/@vuepress/theme-default/package.json b/packages/@vuepress/theme-default/package.json index 2d32bc0135..2e8d802b3d 100644 --- a/packages/@vuepress/theme-default/package.json +++ b/packages/@vuepress/theme-default/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/theme-default", - "version": "1.7.1", + "version": "1.8.0", "description": "Default theme for VuePress", "keywords": [ "documentation", @@ -21,9 +21,9 @@ "author": "Evan You", "main": "index.js", "dependencies": { - "@vuepress/plugin-active-header-links": "1.7.1", - "@vuepress/plugin-nprogress": "1.7.1", - "@vuepress/plugin-search": "1.7.1", + "@vuepress/plugin-active-header-links": "1.8.0", + "@vuepress/plugin-nprogress": "1.8.0", + "@vuepress/plugin-search": "1.8.0", "docsearch.js": "^2.5.2", "lodash": "^4.17.15", "stylus": "^0.54.8", diff --git a/packages/@vuepress/theme-default/styles/index.styl b/packages/@vuepress/theme-default/styles/index.styl index b4cef3c7e8..1b34f6022a 100644 --- a/packages/@vuepress/theme-default/styles/index.styl +++ b/packages/@vuepress/theme-default/styles/index.styl @@ -125,6 +125,7 @@ h1, h2, h3, h4, h5, h6 + p, + pre, + .custom-block margin-top 2rem + &:focus .header-anchor, &:hover .header-anchor opacity: 1 @@ -147,6 +148,7 @@ a.header-anchor margin-top 0.125em opacity 0 + &:focus, &:hover text-decoration none diff --git a/packages/@vuepress/theme-vue/package.json b/packages/@vuepress/theme-vue/package.json index e10aa13d30..9fa9db8640 100644 --- a/packages/@vuepress/theme-vue/package.json +++ b/packages/@vuepress/theme-vue/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/theme-vue", - "version": "1.7.1", + "version": "1.8.0", "description": "VuePress theme for official Vue projects", "keywords": [ "documentation", @@ -21,7 +21,7 @@ "author": "Evan You", "main": "index.js", "dependencies": { - "@vuepress/theme-default": "1.7.1" + "@vuepress/theme-default": "1.8.0" }, "publishConfig": { "access": "public" diff --git a/packages/docs/docs/config/README.md b/packages/docs/docs/config/README.md index 0d99b85dfb..9400f93d35 100644 --- a/packages/docs/docs/config/README.md +++ b/packages/docs/docs/config/README.md @@ -277,6 +277,13 @@ Function for transforming [header](../miscellaneous/glossary.md#headers) texts i Options for [markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor). (Note: prefer `markdown.slugify` to customize header ids.) +### markdown.pageSuffix + +- Type: `string` +- Default: `.html` + +Option to customize internal links to be compatible when using the [vuepress-plugin-clean-urls](https://vuepress.github.io/en/plugins/clean-urls/). + ### markdown.externalLinks - Type: `Object` diff --git a/packages/docs/docs/guide/frontmatter.md b/packages/docs/docs/guide/frontmatter.md index 5fa3718476..c03b5b98d0 100644 --- a/packages/docs/docs/guide/frontmatter.md +++ b/packages/docs/docs/guide/frontmatter.md @@ -110,7 +110,7 @@ meta: --- ``` -### canonicalUrl +### canonicalUrl - Type: `string` - Default: `undefined` diff --git a/packages/docs/docs/guide/global-computed.md b/packages/docs/docs/guide/global-computed.md index c4d328f73f..21db065fe9 100644 --- a/packages/docs/docs/guide/global-computed.md +++ b/packages/docs/docs/guide/global-computed.md @@ -1,6 +1,6 @@ # Global Computed -In VuePress, some core [computed properties](https://vuejs.org/v2/guide/computed.html#Computed-Properties) can be used by the [default theme](../theme/default-theme-config.md) or custom themes. +In VuePress, some core [computed properties](https://vuejs.org/v2/guide/computed.html#Computed-Properties) can be used by the [default theme](../theme/default-theme-config.md) or custom themes. Or in Markdown pages [using vue](./using-vue.md#access-to-site-page-data). ## $site diff --git a/packages/docs/docs/guide/markdown.md b/packages/docs/docs/guide/markdown.md index 85720eb865..60836a5f00 100644 --- a/packages/docs/docs/guide/markdown.md +++ b/packages/docs/docs/guide/markdown.md @@ -43,6 +43,12 @@ VuePress supports redirecting to clean links. If a link `/foo` is not found, Vue Regardless of whether the permalink and clean-urls plugins are used, your relative path should be defined by the current file structure. In the above example, even though you set the path of `/foo/one.md` to `/foo/one/`, you should still access `/foo/two.md` via `./two.md`. ::: +### Page Suffix + +Pages and internal links get generated with the `.html` suffix by default. + +You can customize this by setting [config.markdown.pageSuffix](../config/README.md#markdown-pagesuffix). + ### External Links Outbound links automatically get `target="_blank" rel="noopener noreferrer"`: diff --git a/packages/docs/docs/guide/using-vue.md b/packages/docs/docs/guide/using-vue.md index e76494b9d0..130bacca5f 100644 --- a/packages/docs/docs/guide/using-vue.md +++ b/packages/docs/docs/guide/using-vue.md @@ -87,7 +87,7 @@ Directives also work: ### Access to Site & Page Data -The compiled component does not have any private data but does have access to the [site metadata](../theme/writing-a-theme.md#site-and-page-metadata). For example: +The compiled component does not have any private data but does have access to the [site metadata](../theme/writing-a-theme.md#site-and-page-metadata) and [computed properties](./global-computed.md). For example: **Input** diff --git a/packages/docs/docs/zh/config/README.md b/packages/docs/docs/zh/config/README.md index 20878db3c9..4166896228 100644 --- a/packages/docs/docs/zh/config/README.md +++ b/packages/docs/docs/zh/config/README.md @@ -273,6 +273,13 @@ VuePress 提供了一种添加额外样式的简便方法。你可以创建一 [markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor) 的选项。 +### markdown.pageSuffix + +- 类型: `string` +- 默认值: `.html` + +Option to customize internal links to be compatible when using the [vuepress-plugin-clean-urls](https://vuepress.github.io/en/plugins/clean-urls/). + ### markdown.externalLinks - 类型: `Object` diff --git a/packages/docs/docs/zh/guide/markdown.md b/packages/docs/docs/zh/guide/markdown.md index 07cf87b44f..9ab857cb80 100644 --- a/packages/docs/docs/zh/guide/markdown.md +++ b/packages/docs/docs/zh/guide/markdown.md @@ -43,6 +43,12 @@ VuePress 支持重定向到干净链接。如果一个链接 `/foo` 找不到, 无论是否使用了 permalink 和 clean-urls 插件,你的相对路径都应该依赖于当前的文件结构来定义。在上面的例子中,即使你将 `/foo/one.md` 的路径设为了 `/foo/one/`,你依然应该通过 `./two.md` 来访问 `/foo/two.md`。 ::: +### Page Suffix + +Pages and internal links get generated with the `.html` suffix by default. + +You can customize this by setting [config.markdown.pageSuffix](../config/README.md#markdown-pagesuffix). + ### 外部链接 外部的链接将会被自动地设置为 `target="_blank" rel="noopener noreferrer"`: diff --git a/packages/docs/package.json b/packages/docs/package.json index 503c67715c..bdab396b45 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -1,6 +1,6 @@ { "name": "docs", - "version": "1.7.1", + "version": "1.8.0", "private": true, "description": "docs of VuePress", "keywords": [ @@ -29,11 +29,11 @@ }, "devDependencies": { "@textlint-rule/textlint-rule-no-unmatched-pair": "^1.0.7", - "@vuepress/plugin-back-to-top": "1.7.1", - "@vuepress/plugin-google-analytics": "1.7.1", - "@vuepress/plugin-medium-zoom": "1.7.1", - "@vuepress/plugin-pwa": "1.7.1", - "@vuepress/theme-vue": "1.7.1", + "@vuepress/plugin-back-to-top": "1.8.0", + "@vuepress/plugin-google-analytics": "1.8.0", + "@vuepress/plugin-medium-zoom": "1.8.0", + "@vuepress/plugin-pwa": "1.8.0", + "@vuepress/theme-vue": "1.8.0", "remark-cli": "^7.0.0", "remark-lint": "^6.0.5", "remark-preset-lint-consistent": "^2.0.3", @@ -48,7 +48,7 @@ "textlint-rule-terminology": "^2.1.4", "textlint-rule-write-good": "^1.6.2", "vue-toasted": "^1.1.25", - "vuepress": "1.7.1", + "vuepress": "1.8.0", "vuepress-plugin-flowchart": "^1.4.2" } } diff --git a/packages/vuepress/package.json b/packages/vuepress/package.json index 8bcd095b92..2d826212fa 100644 --- a/packages/vuepress/package.json +++ b/packages/vuepress/package.json @@ -1,6 +1,6 @@ { "name": "vuepress", - "version": "1.7.1", + "version": "1.8.0", "description": "Minimalistic doc generator with Vue component based layout system", "keywords": [ "documentation", @@ -29,8 +29,8 @@ ">1%" ], "dependencies": { - "@vuepress/core": "1.7.1", - "@vuepress/theme-default": "1.7.1", + "@vuepress/core": "1.8.0", + "@vuepress/theme-default": "1.8.0", "cac": "^6.5.6", "envinfo": "^7.2.0", "opencollective-postinstall": "^2.0.2",