Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/vuepress
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.6.0
Choose a base ref
...
head repository: vuejs/vuepress
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.6.1
Choose a head ref
  • 13 commits
  • 13 files changed
  • 6 contributors

Commits on Apr 18, 2018

  1. chore: changelog

    yyx990803 committed Apr 18, 2018
    Copy the full SHA
    69772bd View commit details
  2. Copy the full SHA
    c4772f4 View commit details
  3. fix: use header's slug as it is if possible (#119)

    Hyunje Jun authored and yyx990803 committed Apr 18, 2018
    Copy the full SHA
    5f7e199 View commit details
  4. Copy the full SHA
    ad83169 View commit details
  5. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    846eb59 View commit details
  6. Copy the full SHA
    f052472 View commit details
  7. Copy the full SHA
    efff472 View commit details
  8. fix: service worker path

    yyx990803 committed Apr 18, 2018
    Copy the full SHA
    51c6eb2 View commit details
  9. tweak(default-theme): Adds hr element style (#126)

    This adds some styling to the hr element which is produced when you have
    `---` in markdown on a line on its own. This makes the element look like
    all other border elements 1px, of $borderColor.
    mdaffin authored and yyx990803 committed Apr 18, 2018
    Copy the full SHA
    bc2366d View commit details
  10. Copy the full SHA
    196f23e View commit details
  11. Copy the full SHA
    fd447ae View commit details
  12. Copy the full SHA
    c6c71af View commit details
  13. 0.6.1

    yyx990803 committed Apr 18, 2018
    Copy the full SHA
    6407d86 View commit details
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
<a name="0.6.0"></a>
# [0.6.0](https://github.com/vuejs/vuepress/compare/v0.5.1...v0.6.0) (2018-04-18)


### Bug Fixes

* allow viewport scaling (close [#110](https://github.com/vuejs/vuepress/issues/110)) ([2b2a07d](https://github.com/vuejs/vuepress/commit/2b2a07d))
* cli build --dest flag ([#97](https://github.com/vuejs/vuepress/issues/97)) ([e32d90b](https://github.com/vuejs/vuepress/commit/e32d90b))
* css safe ([#96](https://github.com/vuejs/vuepress/issues/96)) ([be82e09](https://github.com/vuejs/vuepress/commit/be82e09))
* **default-theme:** only show features div if provided ([3f76bfe](https://github.com/vuejs/vuepress/commit/3f76bfe))
* ensure using the same markdown config when extracting headers ([14d4d25](https://github.com/vuejs/vuepress/commit/14d4d25))
* handle index.md when checking relative links ([52d6672](https://github.com/vuejs/vuepress/commit/52d6672))


### Features

* Multiple Language Support + Complete Chinese Translation ([#48](https://github.com/vuejs/vuepress/issues/48)) ([8bbc5f3](https://github.com/vuejs/vuepress/commit/8bbc5f3))
* support yaml config ([#115](https://github.com/vuejs/vuepress/issues/115)) ([3088b3e](https://github.com/vuejs/vuepress/commit/3088b3e))



<a name="0.5.1"></a>
## [0.5.1](https://github.com/vuejs/vuepress/compare/v0.5.0...v0.5.1) (2018-04-17)

8 changes: 4 additions & 4 deletions docs/guide/using-vue.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

Because VuePress applications are server-rendered in Node.js when generating static builds, any Vue usage must conform to the [universal code requirements](https://ssr.vuejs.org/en/universal.html). In short, make sure to only access Browser / DOM APIs in `beforeMounted` or `mounted` hooks.

If you are using or demoing a component that is not SSR friendly (for example containing custom directives), you can wrap them inside the built-in `<ClientOnly>` component:
If you are using or demoing components that are not SSR friendly (for example containing custom directives), you can wrap them inside the built-in `<ClientOnly>` component:

``` md
<ClientOnly>
@@ -58,7 +58,7 @@ Directives also work:

### Access to Site & Page Data

The compiled component does not have any private data but do have access to the [site metadata](./custom-themes.md#site-and-page-metadata). For example:
The compiled component does not have any private data but does have access to the [site metadata](./custom-themes.md#site-and-page-metadata). For example:

**Input**

@@ -96,7 +96,7 @@ By default, fenced code blocks are automatically wrapped with `v-pre`. If you wa

## Using Components

Any `*.vue` file found in `.vuepress/components` are automatically registered as global async components. For example:
Any `*.vue` files found in `.vuepress/components` are automatically registered as [global](https://vuejs.org/v2/guide/components-registration.html#Global-Registration), [async](https://vuejs.org/v2/guide/components-dynamic-async.html#Async-Components) components. For example:

```
.
@@ -118,7 +118,7 @@ Inside any markdown file you can then directly use the components (names are inf
<OtherComponent/>

::: warning IMPORTANT
Make sure a custom component's names either contains a hyphen or is in PascalCase. Otherwise it will be treated as an inline element and wrapped inside a `<p>` tag, which will lead to hydration mismatch because `<p>` does not allow block elements to be placed inside it.
Make sure a custom component's name either contains a hyphen or is in PascalCase. Otherwise it will be treated as an inline element and wrapped inside a `<p>` tag, which will lead to hydration mismatch because `<p>` does not allow block elements to be placed inside it.
:::

## Script & Style Hoisting
1 change: 1 addition & 0 deletions lib/default-theme/Layout.vue
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
@touchstart="onTouchStart"
@touchend="onTouchEnd">
<Navbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar"/>
<div class="sidebar-mask" @click="toggleSidebar(false)"></div>
<Sidebar :items="sidebarItems" @toggle-sidebar="toggleSidebar"/>
<div class="custom-layout" v-if="$page.frontmatter.layout">
<component :is="$page.frontmatter.layout"/>
8 changes: 4 additions & 4 deletions lib/default-theme/NavLinks.vue
Original file line number Diff line number Diff line change
@@ -30,10 +30,10 @@ export default {
components: { OutboundLink, NavLink, DropdownLink },
computed: {
userNav () {
if (Array.isArray(this.$site.themeConfig.nav)) {
return this.$site.themeConfig.nav
}
return this.$site.themeConfig.nav[this.$basepath]
const { nav } = this.$site.themeConfig
if (Array.isArray(nav)) return nav
if (typeof nav === 'object') return nav[this.$basepath]
return []
},
nav () {
if (this.$site.langs && this.$site.langs.length) {
16 changes: 14 additions & 2 deletions lib/default-theme/SearchBox.vue
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ export default {
const max = 5
const { pages } = this.$site
const localePath = this.$basepath
const matches = item => (
item.title &&
item.title.toLowerCase().indexOf(query) > -1
@@ -61,6 +62,10 @@ export default {
for (let i = 0; i < pages.length; i++) {
if (res.length >= max) break
const p = pages[i]
// filter out results that do not match current locale
if (this.getPageLocalePath(p) !== localePath) {
continue
}
if (matches(p)) {
res.push(p)
} else if (p.headers) {
@@ -86,8 +91,15 @@ export default {
}
},
methods: {
onClick () {
console.log('clicked')
getPageLocalePath (page) {
const { langs } = this.$site
for (let i = 0; i < langs.length; i++) {
const localePath = langs[i].path
if (localePath !== '/' && page.path.indexOf(localePath) === 0) {
return langs[i].path
}
}
return '/'
},
onUp () {
if (this.showSuggestions) {
4 changes: 2 additions & 2 deletions lib/default-theme/Sidebar.vue
Original file line number Diff line number Diff line change
@@ -88,12 +88,12 @@ function resolveOpenGroupIndex (route, items) {
font-size 1.1em
padding 0.5rem 0 0.5rem 1.5rem
.sidebar-links
margin-top 1.5rem
padding 1.5rem 0
@media (max-width: $MQMobile)
.sidebar
.nav-links
display block
.sidebar-links
margin-top 1rem
padding 1rem 0
</style>
28 changes: 23 additions & 5 deletions lib/default-theme/styles/theme.styl
Original file line number Diff line number Diff line change
@@ -29,6 +29,15 @@ body
box-sizing border-box
border-bottom 1px solid $borderColor

.sidebar-mask
position fixed
z-index 9
top 0
left 0
width 100vw
height 100vh
display none

.sidebar
font-size 15px
background-color #fff
@@ -133,6 +142,10 @@ code, kbd
p, ul, ol
line-height 1.7

hr
border 0
border-top 1px solid $borderColor

table
border-collapse collapse
margin 1rem 0
@@ -149,11 +162,16 @@ th, td
.custom-layout
padding-top $navbarHeight

.theme-container.no-navbar
.content:not(.custom)
h1, h2, h3, h4, h5, h6
margin-top 1.5rem
padding-top 0
.theme-container
&.sidebar-open
.sidebar-mask
display: block
&.no-navbar
.content:not(.custom)
h1, h2, h3, h4, h5, h6
margin-top 1.5rem
padding-top 0


@media (min-width: ($MQMobile + 1px))
.theme-container.no-sidebar
5 changes: 3 additions & 2 deletions lib/dev.js
Original file line number Diff line number Diff line change
@@ -73,6 +73,7 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
}

const compiler = webpack(config)
const host = cliOptions.host || options.siteConfig.host || '0.0.0.0'
portfinder.basePort = cliOptions.port || options.siteConfig.port || 8080
const port = await portfinder.getPortPromise()

@@ -82,7 +83,7 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
isFirst = false
console.log(
`\n VuePress dev server listening at ${
chalk.cyan(`http://localhost:${port}${options.publicPath}`)
chalk.cyan(`http://${host}:${port}${options.publicPath}`)
}\n`
)
} else {
@@ -97,7 +98,7 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
// in cwd it would break the server
content: [nonExistentDir],
compiler,
host: cliOptions.host || options.siteConfig.host || '0.0.0.0',
host,
dev: { logLevel: 'warn' },
hot: { logLevel: 'error' },
logLevel: 'error',
2 changes: 2 additions & 0 deletions lib/markdown/slugify.js
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@ module.exports = function slugify (str) {
.replace(/\-{2,}/g, '-')
// Remove prefixing and trailing separtors
.replace(/^\-+|\-+$/g, '')
// ensure it doesn't start with a number (#121)
.replace(/^(\d)/, '_$1')
// lowercase
.toLowerCase()
}
3 changes: 2 additions & 1 deletion lib/util/index.js
Original file line number Diff line number Diff line change
@@ -59,10 +59,11 @@ exports.extractHeaders = (content, include = [], md) => {
tokens.forEach((t, i) => {
if (t.type === 'heading_open' && include.includes(t.tag)) {
const title = tokens[i + 1].content
const slug = t.attrs.find(([name]) => name === 'id')[1]
res.push({
level: parseInt(t.tag.slice(1), 10),
title,
slug: md.slugify(title)
slug: slug || md.slugify(title)
})
}
})
2 changes: 1 addition & 1 deletion lib/webpack/createBaseConfig.js
Original file line number Diff line number Diff line change
@@ -221,7 +221,7 @@ module.exports = function createBaseConfig ({
config
.plugin('injections')
.use(require('webpack/lib/DefinePlugin'), [{
BASE_URL: JSON.stringify(siteConfig.base),
BASE_URL: JSON.stringify(siteConfig.base || '/'),
GA_ID: siteConfig.ga ? JSON.stringify(siteConfig.ga) : false,
SW_ENABLED: !!siteConfig.serviceWorker
}])
1 change: 1 addition & 0 deletions lib/webpack/createServerConfig.js
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ module.exports = function createServerConfig (options, cliOptions) {
config
.target('node')
.externals([/^vue|vue-router$/])
.devtool('source-map')

// no need to minimize server build
config.optimization.minimize(false)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuepress",
"version": "0.6.0",
"version": "0.6.1",
"description": "Minimalistic doc generator with Vue component based layout system",
"main": "lib/index.js",
"bin": {