forked from adonisjs/v6-docs
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollections.ts
39 lines (35 loc) · 1.08 KB
/
collections.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
|--------------------------------------------------------------------------
| Collections
|--------------------------------------------------------------------------
|
| Collections represents multiple sources of documentation. For example:
| Guides can be one collection, blog can be another, and API docs can
| be another collection
|
*/
import { Collection } from '@dimerapp/content'
import { renderer } from './bootstrap.js'
const docs = new Collection()
.db(new URL('../content/docs/db.json', import.meta.url))
.useRenderer(renderer)
.urlPrefix('/guides')
.tap((entry) => {
entry.setMarkdownOptions({ tocDepth: 3 })
entry.rendering((mdFile) => {
mdFile.on('link', (node) => {
if (
(node.url &&
!node.url.startsWith('http') &&
!node.url.startsWith('#') &&
!node.url.includes('.md')) ||
(node.url.includes('.md') && !node.url.startsWith('.'))
) {
console.log(mdFile.filePath)
console.log(node)
}
})
})
})
await docs.boot()
export const collections = [docs]