diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index ab1e2115c93902a5cbbf4f8931ab69a82da31f8a..b2068c510c541402910696557df9ff514ea53586 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -15,6 +15,7 @@ module.exports = { '/assets', '/using-vue', '/config', + '/default-theme', '/theming', '/deploy' ] diff --git a/docs/README.md b/docs/README.md index b6c8d25e615970ba64a53e2b12fd77bb43fcaa35..99a78a223d56c8f3c98fb1fae616ea5f85afa94c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,15 +8,15 @@ navTitle: Getting Started ## Why -- Writing first: minimal setup, all you need is a markdown file. +- **Writing First**: minimal setup, all you need is a markdown file. -- Vue-powered: the layout system is a Vue app. It's also pre-rendered into static HTML. And you can register and use Vue components inside markdown content. +- **Vue-powered**: Use custom Vue components inside markdown, and develop custom themes using Vue single file components. -- Flexible: develop with full power of webpack (hot-reload, pre-processors support), generate SEO-friendly static HTML, and works as an SPA after initial page load. +- **Great Dev Experience**: enjoy the same enjoyable development experience of a Vue app. Leverage the full power of webpack (hot-reload, pre-processors), generate SEO-friendly static HTML, and works as an SPA after initial page load. -- Optimized for docs: many built-in markdown extensions and default theme features for writing great documentation. +- **Optimized for Docs**: many [built-in markdown extensions](./markdown.md) and default theme features for writing great documentation. -- GitHub friendly: pages can link to each other using relative links that ends in `.md`, auto-generates GitHub link and page edit links if a repo is provided. +- **GitHub Friendly**: source markdown files can link to each other using relative links that ends in `.md` so they are also readable on GitHub, auto-generates page edit links if a repo is provided. ## Quickstart diff --git a/docs/config.md b/docs/config.md index 68ce4016f0372e55dfc590c14e970f76c372e8fc..c1b2f548241c65b198bafca804d09a2d986c3563 100644 --- a/docs/config.md +++ b/docs/config.md @@ -20,6 +20,8 @@ ### themeConfig +Also see [config options for the default theme](./default-theme.md). + ## Markdown ### markdown.anchor diff --git a/docs/default-theme.md b/docs/default-theme.md new file mode 100644 index 0000000000000000000000000000000000000000..f36984da393f3255d2f97fc759cba2c0b0c0db6f --- /dev/null +++ b/docs/default-theme.md @@ -0,0 +1 @@ +# Default Theme Configuration diff --git a/docs/theming.md b/docs/theming.md index 29235422b030523e7519cdf3fa779ffada945433..960686a858941c4e23397f25338b4af5975db224 100644 --- a/docs/theming.md +++ b/docs/theming.md @@ -1,4 +1,4 @@ -# Theming +# Custom Themes VuePress uses Vue single file components for custom themes. To use a custom layout, create a `.vuepress/theme` directory in your docs root, and then create a `Layout.vue` file: diff --git a/docs/using-vue.md b/docs/using-vue.md index a472bdf1fdd5348f705256ab545911daca6c43d7..a147f4854ce4fbd2ec63acb5dcd797bf3e949dda 100644 --- a/docs/using-vue.md +++ b/docs/using-vue.md @@ -42,18 +42,32 @@ The compiled component does not have any private data but do have access to the **Output** -
{{ $page }}
+``` json +{ + "path": "/using-vue.html", + "title": "Using Vue in Markdown", + "frontmatter": {} +} +``` ## Escaping By default, fenced code blocks are automatically wrapped with `v-pre`. If you want to display raw mustaches or Vue-specific syntax inside inline code snippets or plain text, you need to wrap a paragraph with the `v-pre` custom container: +**Input** + ``` markdown ::: v-pre `{{ This will be displayed as-is }}` ::: ``` +**Output** + +::: v-pre +`{{ This will be displayed as-is }}` +::: + ## Using Components Any `*.vue` file found in `.vuepress/components` are automatically registered as global async components. For example: @@ -77,7 +91,7 @@ Inside any markdown file you can then directly use the components (names are inf -::: warning +::: 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 `

` tag, which will lead to hydration mismatch because `

` does not allow block elements to be placed inside it. ::: diff --git a/lib/app/index.dev.html b/lib/app/index.dev.html index d3ef49ee6bb5916345e336b301985894f0867749..d27b7a25fadd249ba8f4807b4cf8d6c3930fb655 100644 --- a/lib/app/index.dev.html +++ b/lib/app/index.dev.html @@ -2,6 +2,7 @@ + diff --git a/lib/app/index.ssr.html b/lib/app/index.ssr.html index 474281551d805ca6d1b417a24c7dfe1a706e4b25..d61f12366ee78e637adba224208f024a781b9273 100644 --- a/lib/app/index.ssr.html +++ b/lib/app/index.ssr.html @@ -2,6 +2,7 @@ + {{ title }} {{{ userHeadTags }}} {{{ pageMeta }}} diff --git a/lib/default-theme/Layout.vue b/lib/default-theme/Layout.vue index 624b7bb884b4cb519ea0cdcff81c8449a4a968a4..1776121fa679755ae14f314fbb88b05f92c8210d 100644 --- a/lib/default-theme/Layout.vue +++ b/lib/default-theme/Layout.vue @@ -1,12 +1,14 @@