Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update docs #400

Merged
merged 33 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8c6c4bc
:bug: (admin) update admin runtime plugin
Tahul Jun 9, 2021
29b7244
:sparkles: (theme) update default theme, add contentDir to windi parsing
Tahul Jun 9, 2021
917f33a
:sparkles: (asidebottom) update resources
Tahul Jun 9, 2021
2f41c3c
:sparkles: (windi) cleanup windi config
Tahul Jun 9, 2021
1aad740
:sparkles: (github) update github module logging
Tahul Jun 9, 2021
aedff63
:sparkles: (prose) move prose components in its own folder
Tahul Jun 9, 2021
8b100f8
:sparkles: (components) refact components (wip)
Tahul Jun 9, 2021
d586911
:sparkles: (content) update components (heavily wip)
Tahul Jun 9, 2021
4811f0a
:bug: (social-image) fix social image preview
Tahul Jun 9, 2021
0788710
:bug: (navigation) make it fill space on desktop
Tahul Jun 10, 2021
781ff2e
:pencil: (docs) write a lot of content
Tahul Jun 10, 2021
eed5310
:pencil2: (js) js by default
Tahul Jun 10, 2021
af5ed2c
:wrench: (package) add generate:nuxtjs command
Tahul Jun 10, 2021
de96395
:sparkles: (theme) add default slot in card
Tahul Jun 10, 2021
e8db3d2
:pencil: (links) fix broken links
Tahul Jun 10, 2021
ef80025
:pencil: (fix) tagline
Tahul Jun 10, 2021
73c52c1
:pencil: (prose) improve prose page
Tahul Jun 10, 2021
ecdbc24
:pencil: (prose) improve prose page
Tahul Jun 10, 2021
e00c28e
Update docs/content/1.get-started/1.installation.md
Tahul Jun 10, 2021
5fe524f
Update docs/content/1.get-started/1.installation.md
Tahul Jun 10, 2021
e215a95
Update docs/content/2.writing/1.my-first-page.md
Tahul Jun 10, 2021
66a151c
Update docs/content/2.writing/2.syntax.md
Tahul Jun 10, 2021
1041609
Update docs/content/2.writing/1.my-first-page.md
Tahul Jun 10, 2021
3afad5b
Update docs/content/2.writing/2.syntax.md
Tahul Jun 10, 2021
1c6a315
Update docs/content/3.features/5.deployment.md
Tahul Jun 10, 2021
032a313
Update docs/content/3.features/5.deployment.md
Tahul Jun 10, 2021
a5d42fe
Update docs/content/4.theme/1.settings.md
Tahul Jun 10, 2021
7243055
:pencil: (components) try to fix inject content
Tahul Jun 10, 2021
585d58d
Update docs/content/2.writing/2.syntax.md
Tahul Jun 10, 2021
6c46d0e
Update docs/content/3.features/5.deployment.md
Tahul Jun 10, 2021
7e3cfd1
Update docs/content/2.writing/3.front-matter.md
Tahul Jun 10, 2021
7a5856e
Update docs/content/2.writing/3.front-matter.md
Tahul Jun 10, 2021
803bfbd
:pencil: (docs) update front-matter & fix components
Tahul Jun 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/components/AsideBottom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export default defineComponent({
icon: 'IconWindi'
},
{
title: 'Nuxt Content',
url: 'https://content.nuxtjs.org',
icon: 'IconNuxtContent'
title: 'CodeSandbox',
url: 'https://codesandbox.io/embed/docus-starter-1xsm7?hidenavigation=1&theme=dark',
icon: 'IconCodeSandbox'
}
]
}
Expand Down
4 changes: 4 additions & 0 deletions docs/components/HeaderNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
<ButtonLink v-show="$route.path === '/'" href="/get-started/installation" size="small" bold>
Get started
</ButtonLink>

<ButtonLink v-show="$route.path.includes('templates')" href="/get-started/installation" size="small" bold>
Back to Docs
</ButtonLink>
</div>
</template>
76 changes: 40 additions & 36 deletions docs/content/1.get-started/1.installation.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
# Installation

> Setting up beautiful documentation with Docus is one command away 🤙
> Setting up a beautiful website with Docus is one command away. 🤙

Docus is a pre-configured [Nuxt](https://nuxtjs.org) application, with [Windi CSS](https://windicss.org) and [Nuxt Content](https://content.nuxtjs.org).
Docus is an opinionated [Nuxt](https://nuxtjs.org) application.

It allows you to generate **content-based websites** with ease.
Tahul marked this conversation as resolved.
Show resolved Hide resolved

## System Requirements

- Node.js [12](https://nodejs.org/en/) or later
- MacOS, Windows, and Linux are supported
- Node.js [14](https://nodejs.org/en/) or above.
- MacOS, Windows, and Linux are supported.
Tahul marked this conversation as resolved.
Show resolved Hide resolved

## Quick start

### GitHub Template
### Clone locally

Start your documentation in a new GitHub repository by using our [GitHub template](https://github.com/nuxtlabs/docus-starter):
You can download the starter locally using [degit](https://github.com/Rich-Harris/degit).

::button-link{size="medium" blank href="https://github.com/nuxtlabs/docus-starter/generate"}
Create a repo with the Docus starter
::
This allows you to add documentation to your existing repository.

### Download locally

You can download the starter locally using [degit](https://github.com/Rich-Harris/degit). This allows you to add documentation to your existing repository.

```
```bash
npx degit nuxtlabs/docus-starter#main docs
```

This command will create a new folder named `docs/` and download the Docus starter inside.

### GitHub Template

Start your documentation in a new GitHub repository by using our [GitHub template](https://github.com/nuxtlabs/docus-starter):

::button-link{size="medium" blank href="https://github.com/nuxtlabs/docus-starter/generate"}
Create a repo with the Docus starter
::

### Vercel Template

Vercel lets you set up the starter on your favorite Git provider (GitHub, GitLab or Bitbucket) - and deploy for free.
Expand All @@ -37,39 +41,25 @@ Vercel lets you set up the starter on your favorite Git provider (GitHub, GitLab
Create and deploy using Vercel
::

**See it in action**:

::video-player{loop playsinline controls}
sources:
- src: https://res.cloudinary.com/nuxt/video/upload/q_auto/v1612886404/docus/docus-vercel_wwaryz.webm
type: video/webm
- src: https://res.cloudinary.com/nuxt/video/upload/q_auto/v1612886404/docus/docus-vercel_wwaryz.mp4
type: video/mp4
- src: https//res.cloudinary.com/nuxt/video/upload/q_auto/v1612886404/docus/docus-vercel_wwaryz.ogv
type: video/ogg
poster: https://res.cloudinary.com/nuxt/video/upload/v1612886404/docus/docus-vercel_wwaryz.jpg
---
::

## Directory Structure

The directory structure of a minimal Docus project is the following:
The directory structure of a minimal **Docus** project is the following:

```bash
| content/
---| index.md
---| settings.json
| static/
---| icon.png
---| preview.png
| nuxt.config.js
| nuxt.config.{ts|js}
| docus.config.{ts|js}
| package.json
```

- Configure Docus with [content/settings.json](/get-started/configuration)
- Write your documentation within [content/{locale}](/usage/content)
- Use our [included components](/usage/components)
- Manage your images and assets in [static/](/usage/assets)
- Configure Docus with [docus.config.js](/get-started/configuration).
- Write your documentation within [content/](/writing/my-first-page).
- Use our [included components](/theme/components) or yours.
- Manage your images and assets in [static/](/features/assets).

## Start docus

Expand All @@ -81,4 +71,18 @@ yarn dev

The development server will listen on [http://localhost:4000](http://localhost:4000)

Checkout the [Deployment](/more/deployment) section when you are ready to publish your documentation.
Checkout the [Deployment](/feature/deployment) section when you are ready to publish your documentation.

## Demo

::video-player{loop playsinline controls}
sources:
- src: https://res.cloudinary.com/nuxt/video/upload/q_auto/v1612886404/docus/docus-vercel_wwaryz.webm
type: video/webm
- src: https://res.cloudinary.com/nuxt/video/upload/q_auto/v1612886404/docus/docus-vercel_wwaryz.mp4
type: video/mp4
- src: https//res.cloudinary.com/nuxt/video/upload/q_auto/v1612886404/docus/docus-vercel_wwaryz.ogv
type: video/ogg
poster: https://res.cloudinary.com/nuxt/video/upload/v1612886404/docus/docus-vercel_wwaryz.jpg
---
::
162 changes: 61 additions & 101 deletions docs/content/1.get-started/2.configuration.md
Original file line number Diff line number Diff line change
@@ -1,121 +1,81 @@
# Configuration

> Tailor Docus for your own identity easily :rainbow:
> Tailor Docus for your own identity easily. 🌈

## Website

You can create a `content/settings.json` file to configure the website.
You need to create a `docus.config.js` file to configure the website.

```json [content/settings.json]
{
"title": "Docus",
"url": "https://docus.dev",
// Optional
"layout": "docs",
"logo": "logo.svg",
"twitter": "@nuxt_js",
"github": "nuxtlabs/docus"
}
```

### Properties

| Key | Type | Description |
|---------|------|-------------|
| `title` | `String` | Documentation title |
| `description` | `String` | Brief summary about documentation, added for search engine optimization and social sharing |
| `url` | `String` | Url of your deployed documentation. |
| `layout` | `String` | The layout of your documentation (defaults to `docs`). Can be changed to `readme` to have a one-page doc. |
| `logo` | `String` `Object` | Logo of the project, can be an `Object` to set a logo per [color mode](https://github.com/nuxt-community/color-mode-module). To display the logo, see `header.logo` section. |
| `header.logo` | `Boolean` | Defaults to `false`, set to `true` to display the logo in header. |
| `header.title` | `Boolean` | Defaults to `true`, set to `false` to hide the title and only display the logo in header. |
| `twitter` | `String` | Twitter username to link in the header. Example: `@nuxt_js`. |
| `github` | `Object` or `String` | Can be a `String` to act as `github.repo` if no other config is needed. |
| `github.repo` | `String` | GitHub repository for the project. This will enable displaying the last version, the releases page, the link at the top and the `Edit this page on GitHub link` on each page. Example: `nuxt/content`. |
| `github.url` | `String` | For GitHub Enterprise, in addition to `github.repo`, you have to assign an url. Example: `https://hostname`. Defaults to `https://github.com`. |
| `github.apiUrl` | `String` | For GitHub Enterprise, in addition to `github.repo`, you have to assign an api url. Example: `https://hostname/api/v3/repos`. Defaults to `https://api.github.com/repos`. |
| `github.branch` | `String` | The default branch for the GitHub repository of your project, used in the `Edit this page on GitHub link` on each page (defaults to `main` if it cannot be detected). |
| `github.dir` | `String` | The default dir of your project, used in the `Edit this page on GitHub link` on each page (defaults to `''`). Change it if docus is not at the root of your repository. |
| `github.releases` | `Boolean` | Defaults to true, set to false to disable the releases page. |
| `algolia` | `Object` | This option allows you to use [Algolia DocSearch](https://docsearch.algolia.com). In order to enable it, you need to provide at least the `apiKey` and the `indexName`. See example below. |
| `credits` | `Boolean` | Defaults to `true`, set to `false` to hide `Made with Docus` credits |

### Algolia Search

This option allows you to use [Algolia DocSearch](https://docsearch.algolia.com). In order to enable it, you need to provide at least the `apiKey` and the `indexName`:
::code-group

```json [content/settings.json]
"algolia": {
"apiKey": "<API_KEY>",
"indexName": "<INDEX_NAME>",
"langAttribute": "language"
```javascript [Default config]
export default {
title: "Docus",
url: "https://docus.dev",
description: 'Write in markdown, use Vue components, style with Windi CSS and enjoy the power of Nuxt.',
template: 'docs',
contentDir: 'content'
}
```

If you use `i18n`, make sure the `<langAttribute>` is the same as the html lang selector in the config (defaults to `language`).

Take a look at the [@nuxt/content](https://github.com/algolia/docsearch-configs/blob/master/configs/nuxtjs_content.json) docsearch config for an example.

## Theme

Create `content/theme.json` file to configure the theme.

```json [content/theme.json]
{
"colors": {
"primary": "#06B6D4",
"code": {
"string": "#679c0d"
```javascript [Full config]
export default {
title: "Docus",
url: "https://docus.dev",
description: 'Write in markdown, use Vue components, style with Windi CSS and enjoy the power of Nuxt.',
template: 'docs',
contentDir: 'content',
layout: {
header: true,
footer: true,
aside: false,
asideClass: '',
fluid: false
},
github: {
repo: 'nuxtlabs/docus',
branch: 'main',
dir: 'docs',
releases: true,
url: 'https://github.com',
apiUrl: 'https://api.github.com/repos'
},
theme: {
header: {
title: false,
logo: {
dark: '/img/logo-dark.svg',
light: '/img/logo-light.svg'
}
},
colors: {
primary: '#00DC82'
}
}
}
```

The theme design is based on a `primary` color to make it easy to override, you can specify it using `colors.primary` in your `content/theme.json`, the color palette (50 to 900) is generated using [theme-colors](https://github.com/nuxt-contrib/theme-colors).

::

### Properties

| Key | Type | Description |
|---------|------|-------------|
| `colors` | `Object` | An object containing all colors for the theme. |
| `colors.primary` | `String` | The primary color of the theme, the value should be hexadecimal or rgb (`145,22,74`). Default value is `#3073F1`. |
| `colors.code` | `Object` | The object containing the colors of Prism theme. You know the list of all available colors names, look at [Prism theme vars documentaion](https://github.com/antfu/prism-theme-vars#configuration)|

## Nuxt

`docus` exports a function to setup the `nuxt.config.js` and allows you to add/override the [Nuxt config](https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-build).

You can checkout the [default nuxt.config.js](https://github.com/nuxt/docus/blob/main/src/app/nuxt.config.js) from Docus. We use [defu.arrayFn](https://github.com/nuxt-contrib/defu#array-function-merger) to merge the default configuration with the one provided.

Example with custom configuration:

```ts [nuxt.config.js]
import { withDocus } from 'docus'

export default withDocus({
buildModules: [
'vue-plausible'
]
plausible: {
domain: 'docus.dev'
}
})
```

## Windi CSS

You can override the [default Windi config](https://github.com/nuxt/docus/blob/main/src/theme/windi.config.js) by creating your own `windi.config.js`.

```js [windi.config.js]
module.exports = {
theme: {
extend: {
// ...
}
}
}
```


As with the [Nuxt config](#nuxt), we use [defu.arrayFn](https://github.com/nuxt-contrib/defu#array-function-merger) to merge configurations.
| `title` | `String` | Website title. |
| `description` | `String` | Brief summary about your website, added for SEO and OpenGraph. |
| `url` | `String` | Target URL of your website. |
| `contentDir` | `String` | The path of your website content directory. |
| `theme` | `Object` | Your theme configuration, see [here](/theme/settings) for default theme. |
| **Layout** | | |
| `layout.header` | `Boolean` | If set to `false`, it will hide the AppHeader by default. |
| `layout.footer` | `Boolean` | If set to `false`, it will hide the AppFooter by default. |
| `layout.fluid` | `Boolean` | If set to `true`, the page container will be fluid by default. |
| `layout.aside` | `Boolean` | If set to `false`, it will hide the AppAside by default. |
| `layout.asideClass` | `String` | Class attribute that will be applied to AsideNavigation by default. |
| :icon-git-hub{class="inline w-4 -mt-0.5"} **GitHub Module** | | |
| `github.repo` | `String` | Your project repository. |
| `github.branch` | `String` | The branch to link. |
| `github.dir` | `String` | The directory in which Docus lives in that repository. |
| `github.releases` | `Boolean` | If set to true, Docus will fetch Github releases. |
| `github.url` | `String` | The root URL of GitHub. (set by default) |
| `github.apiUrl` | `String` | The API URL of GitHub. (set by default) |
Loading