mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
* chore: add missing Vue support for Vercel builds * refactor: move some functions and module-level state into classes as private methods and properties to start to encapsulate Docsify Also some small tweaks: - move initGlobalAPI out of Docsify.js to start to encapsulate Docsify - move ajax to utils folder - fix some type definitions and improve content in some JSDoc comments - use concise class field syntax - consolidate duplicate docsify-ignore comment removal code This handles a task in [Simplify and modernize Docsify](https://github.com/docsifyjs/docsify/issues/2104), as well as works towards [Encapsulating Docsify](https://github.com/docsifyjs/docsify/issues/2135). * chore: add prettier code format check to our lint script, and add a prettier script for manually formatting the whole code base * chore: update issue/pr templates * chore: apply our format to the whole code base --------- Co-authored-by: Koy <koy@ko8e24.top> Co-authored-by: i544693 <369491420@qq.com>
98 lines
1.8 KiB
Markdown
98 lines
1.8 KiB
Markdown
# Cover
|
|
|
|
Activate the cover feature by setting `coverpage` to **true**. See [coverpage configuration](configuration.md#coverpage).
|
|
|
|
## Basic usage
|
|
|
|
Set `coverpage` to **true**, and create a `_coverpage.md`:
|
|
|
|
```html
|
|
<!-- index.html -->
|
|
|
|
<script>
|
|
window.$docsify = {
|
|
coverpage: true,
|
|
};
|
|
</script>
|
|
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
|
|
```
|
|
|
|
```markdown
|
|
<!-- _coverpage.md -->
|
|
|
|

|
|
|
|
# docsify <small>3.5</small>
|
|
|
|
> A magical documentation site generator.
|
|
|
|
- Simple and lightweight
|
|
- No statically built html files
|
|
- Multiple themes
|
|
|
|
[GitHub](https://github.com/docsifyjs/docsify/)
|
|
[Get Started](#docsify)
|
|
```
|
|
|
|
## Custom background
|
|
|
|
The background color is generated randomly by default. You can customize the background color or a background image:
|
|
|
|
```markdown
|
|
<!-- _coverpage.md -->
|
|
|
|
# docsify <small>3.5</small>
|
|
|
|
[GitHub](https://github.com/docsifyjs/docsify/)
|
|
[Get Started](#quick-start)
|
|
|
|
<!-- background image -->
|
|
|
|

|
|
|
|
<!-- background color -->
|
|
|
|

|
|
```
|
|
|
|
## Coverpage as homepage
|
|
|
|
Normally, the coverpage and the homepage appear at the same time. Of course, you can also separate the coverpage by [onlyCover option](configuration.md#onlycover).
|
|
|
|
## Multiple covers
|
|
|
|
If your docs site is in more than one language, it may be useful to set multiple covers.
|
|
|
|
For example, your docs structure is like this
|
|
|
|
```text
|
|
.
|
|
└── docs
|
|
├── README.md
|
|
├── guide.md
|
|
├── _coverpage.md
|
|
└── zh-cn
|
|
├── README.md
|
|
└── guide.md
|
|
└── _coverpage.md
|
|
```
|
|
|
|
Now, you can set
|
|
|
|
```js
|
|
window.$docsify = {
|
|
coverpage: ['/', '/zh-cn/'],
|
|
};
|
|
```
|
|
|
|
Or a special file name
|
|
|
|
```js
|
|
window.$docsify = {
|
|
coverpage: {
|
|
'/': 'cover.md',
|
|
'/zh-cn/': 'cover.md',
|
|
},
|
|
};
|
|
```
|