From 4b57304b094ce2f12cf111718e2047f33aa4bb44 Mon Sep 17 00:00:00 2001 From: Farnabaz Date: Fri, 11 Jun 2021 20:34:32 +0430 Subject: [PATCH 1/5] fix: do not remove H1 from markdown content --- docs/content/1.get-started/1.installation.md | 2 +- docs/content/1.get-started/2.configuration.md | 2 +- docs/content/2.writing/1.my-first-page.md | 2 +- docs/content/2.writing/2.syntax.md | 2 +- docs/content/2.writing/3.front-matter.md | 6 +++--- docs/content/2.writing/4.prose.md | 2 +- docs/content/3.features/1.routing.md | 2 +- docs/content/3.features/2.localization.md | 2 +- docs/content/3.features/3.assets.md | 2 +- docs/content/3.features/4.social-image.md | 2 +- docs/content/3.features/5.deployment.md | 2 +- docs/content/3.features/6.extend.md | 2 +- docs/content/3.features/7.migration.md | 2 +- docs/content/4.theme/1.settings.md | 2 +- docs/content/4.theme/2.components.md | 2 +- docs/content/4.theme/5.layout.md | 2 +- docs/content/4.theme/6.slots.md | 2 +- src/core/utils/document.ts | 12 ++---------- .../components/organisms/PageContent.vue | 14 ++++++++++++-- 19 files changed, 33 insertions(+), 31 deletions(-) diff --git a/docs/content/1.get-started/1.installation.md b/docs/content/1.get-started/1.installation.md index a5a0443f6..1c8f7a642 100644 --- a/docs/content/1.get-started/1.installation.md +++ b/docs/content/1.get-started/1.installation.md @@ -1,6 +1,6 @@ # Installation -> Setting up a beautiful website with Docus is one command away. ðŸĪ™ +Setting up a beautiful website with Docus is one command away. ðŸĪ™ Docus is an opinionated [Nuxt](https://nuxtjs.org) application that allows you to generate **content-based websites** with ease. diff --git a/docs/content/1.get-started/2.configuration.md b/docs/content/1.get-started/2.configuration.md index d91b9ef75..d6158403d 100644 --- a/docs/content/1.get-started/2.configuration.md +++ b/docs/content/1.get-started/2.configuration.md @@ -1,6 +1,6 @@ # Configuration -> Tailor Docus for your own identity easily. 🌈 +Tailor Docus for your own identity easily. 🌈 ## Website diff --git a/docs/content/2.writing/1.my-first-page.md b/docs/content/2.writing/1.my-first-page.md index 33b7f8884..8c9cc6bcd 100644 --- a/docs/content/2.writing/1.my-first-page.md +++ b/docs/content/2.writing/1.my-first-page.md @@ -5,7 +5,7 @@ navigation: # Writing my first page -> The fastest path to writing your content. 🏎 +The fastest path to writing your content. 🏎 Let's walk through the creation of a simple introduction page. diff --git a/docs/content/2.writing/2.syntax.md b/docs/content/2.writing/2.syntax.md index 9a83e1c09..0036fccea 100644 --- a/docs/content/2.writing/2.syntax.md +++ b/docs/content/2.writing/2.syntax.md @@ -1,6 +1,6 @@ # Syntax -> Docus syntax makes you love your components even more. ðŸĪ +Docus syntax makes you love your components even more. ðŸĪ Docus writing experience is based on a specific syntax built upon Vue components. diff --git a/docs/content/2.writing/3.front-matter.md b/docs/content/2.writing/3.front-matter.md index 9f98f786a..522491396 100644 --- a/docs/content/2.writing/3.front-matter.md +++ b/docs/content/2.writing/3.front-matter.md @@ -1,6 +1,6 @@ # Front-matter -> Easily configure the rendering of your Markdown pages. 📝 +Easily configure the rendering of your Markdown pages. 📝 Front-matter is used to transmit data to your components and templates, from any page or directory. @@ -42,7 +42,7 @@ The **title** and **description** are automatically filled in from the Markdown ```md # Title of the page -> Description of the page +Description of the page ``` You can overwrite them using the Front-matter: @@ -55,7 +55,7 @@ description: Overwritten description # Title of the page -> Description of the page +Description of the page ``` ## Inheritance diff --git a/docs/content/2.writing/4.prose.md b/docs/content/2.writing/4.prose.md index e334cfa73..3e751ee48 100644 --- a/docs/content/2.writing/4.prose.md +++ b/docs/content/2.writing/4.prose.md @@ -1,6 +1,6 @@ # Prose -> Customizing your Markdown rendering has never been easier. 🧙‍♂ïļ +Customizing your Markdown rendering has never been easier. 🧙‍♂ïļ Docus Markdown rendering preserves the HTML structure of your file. diff --git a/docs/content/3.features/1.routing.md b/docs/content/3.features/1.routing.md index a185f63a3..9467eef7e 100644 --- a/docs/content/3.features/1.routing.md +++ b/docs/content/3.features/1.routing.md @@ -1,6 +1,6 @@ # Filesystem routing -> A good looking website from any directory. ðŸ”Ū +A good looking website from any directory. ðŸ”Ū Each markdown page in the `contentDir` directory will become a page and will be listed in the left navigation. diff --git a/docs/content/3.features/2.localization.md b/docs/content/3.features/2.localization.md index 439aff674..aa3cdc848 100644 --- a/docs/content/3.features/2.localization.md +++ b/docs/content/3.features/2.localization.md @@ -1,6 +1,6 @@ # Localization -> Enable i18n just by creating a directory. 🗚 +Enable i18n just by creating a directory. 🗚 The first level of directories in the `content/` folder are the locales used with [nuxt-i18n](https://github.com/nuxt-community/i18n-module) as defined in your `nuxt.config.js`. diff --git a/docs/content/3.features/3.assets.md b/docs/content/3.features/3.assets.md index a1dc898b0..70b2fd03f 100644 --- a/docs/content/3.features/3.assets.md +++ b/docs/content/3.features/3.assets.md @@ -1,6 +1,6 @@ # Assets -> Easily import and optimize your assets with pre-defined modules. 🙈 +Easily import and optimize your assets with pre-defined modules. 🙈 ## Favicon and PWA Icon diff --git a/docs/content/3.features/4.social-image.md b/docs/content/3.features/4.social-image.md index 7756a3828..5fd719aa6 100644 --- a/docs/content/3.features/4.social-image.md +++ b/docs/content/3.features/4.social-image.md @@ -1,6 +1,6 @@ # Social Images -> Docus automatically generates a social preview image for every document. ðŸĪģ +Docus automatically generates a social preview image for every document. ðŸĪģ It uses the `social-image-preview` page to generate the images. diff --git a/docs/content/3.features/5.deployment.md b/docs/content/3.features/5.deployment.md index 4a865451d..9021f5de9 100644 --- a/docs/content/3.features/5.deployment.md +++ b/docs/content/3.features/5.deployment.md @@ -1,6 +1,6 @@ # Deployment -> Deploy your documentation with Docus to any static hosting. ðŸŠķ +Deploy your documentation with Docus to any static hosting. ðŸŠķ To generate the documentation for production, run the following command: diff --git a/docs/content/3.features/6.extend.md b/docs/content/3.features/6.extend.md index 9461bd020..3c9cca50d 100644 --- a/docs/content/3.features/6.extend.md +++ b/docs/content/3.features/6.extend.md @@ -1,6 +1,6 @@ # Extend -> Extend Docus with the power of Nuxt modules. 🚀 +Extend Docus with the power of Nuxt modules. 🚀 Docus is based on Nuxt, so you can benefit from the existing ecosystem of [Nuxt Modules](https://modules.nuxtjs.org/). diff --git a/docs/content/3.features/7.migration.md b/docs/content/3.features/7.migration.md index 84ed5944a..5e8046cef 100644 --- a/docs/content/3.features/7.migration.md +++ b/docs/content/3.features/7.migration.md @@ -5,7 +5,7 @@ navigation: # Migrate from @nuxt/content-theme-docs -> Migrate from @nuxt/content-theme-docs to Docus. 🔋 +Migrate from @nuxt/content-theme-docs to Docus. 🔋 By migrating to Docus, you will have a fresh new design for your documentation :sparkles: diff --git a/docs/content/4.theme/1.settings.md b/docs/content/4.theme/1.settings.md index 4f592a94e..6cf879c30 100644 --- a/docs/content/4.theme/1.settings.md +++ b/docs/content/4.theme/1.settings.md @@ -5,7 +5,7 @@ navigation: # Theme settings -> The default theme is entirely customizable, from a simple configuration file! âœĻ +The default theme is entirely customizable, from a simple configuration file! âœĻ The default configuration sets defaults for every needed feature of your theme. diff --git a/docs/content/4.theme/2.components.md b/docs/content/4.theme/2.components.md index 130de9c2b..e5e0f9f7e 100644 --- a/docs/content/4.theme/2.components.md +++ b/docs/content/4.theme/2.components.md @@ -1,6 +1,6 @@ # Components -> Good looking components, ready to use in your website. 💄 +Good looking components, ready to use in your website. 💄 Docus default theme comes with a lot of pre-defined components. diff --git a/docs/content/4.theme/5.layout.md b/docs/content/4.theme/5.layout.md index cd6adcf94..5d4c79225 100644 --- a/docs/content/4.theme/5.layout.md +++ b/docs/content/4.theme/5.layout.md @@ -1,6 +1,6 @@ # Layout -> Customize your website with slots or overwrite the layout components. ðŸ§Đ +Customize your website with slots or overwrite the layout components. ðŸ§Đ With the power of the [Nuxt Components](https://github.com/nuxt/components#overwriting-components), every part of the template is fully customizable. diff --git a/docs/content/4.theme/6.slots.md b/docs/content/4.theme/6.slots.md index d45c15af0..fddedf9ef 100644 --- a/docs/content/4.theme/6.slots.md +++ b/docs/content/4.theme/6.slots.md @@ -1,6 +1,6 @@ # Slots -> Docus supports customizable slots in the template. ðŸ§ą +Docus supports customizable slots in the template. ðŸ§ą Just create a component inside your `components` directory with the same name as the slot. diff --git a/src/core/utils/document.ts b/src/core/utils/document.ts index 2bc52f849..de6e6439c 100644 --- a/src/core/utils/document.ts +++ b/src/core/utils/document.ts @@ -43,22 +43,14 @@ export function processDocumentInfo(document: DocusDocument): DocusDocument { if (first && expandTags(['h1']).includes(first.tag)) { if (!document.title) { document.title = getTextContent(first) - Object.assign(first, { - type: 'text', - value: '' - }) } // look for second element to find description - if (second && expandTags(['blockquote']).includes(second.tag)) { + if (second && expandTags(['p']).includes(second.tag)) { if (!document.description) { document.description = getTextContent(second) - Object.assign(second, { - type: 'text', - value: '' - }) } } - } else if (first && first.type === 'blockquote') { + } else if (first && first.type === 'p') { if (!document.description) { document.description = getTextContent(first) Object.assign(first, { diff --git a/src/defaultTheme/components/organisms/PageContent.vue b/src/defaultTheme/components/organisms/PageContent.vue index d8039ae85..095257609 100644 --- a/src/defaultTheme/components/organisms/PageContent.vue +++ b/src/defaultTheme/components/organisms/PageContent.vue @@ -1,6 +1,6 @@