Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 2 additions & 7 deletions .vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ import gitCommitInfo from 'git-commit-info'
import { defineConfig } from 'vitepress'
import { pagefindPlugin } from 'vitepress-plugin-pagefind'
import { generateSidebar } from 'vitepress-sidebar'
import { dovecotMdExtend, initDovecotMd } from '../lib/markdown.js'
import { dovecotMdExtend } from '../lib/markdown.js'
import { getExcludes } from '../lib/utility.js'

const base = '/2.4'

// Need to bootstrap configuration for Dovecot markdown driver (specifically,
// loading all data files to allow existence checking), or else the markdown
// processing will begin before Dovecot link markup is enabled
await initDovecotMd(base)

export default defineConfig({
title: "Dovecot CE",
description: "Dovecot CE Documentation",
Expand Down Expand Up @@ -107,7 +102,7 @@ export default defineConfig({
},

markdown: {
config: (md) => dovecotMdExtend(md),
config: async (md) => await dovecotMdExtend(md),
image: {
lazyLoading: true,
},
Expand Down
58 changes: 0 additions & 58 deletions .vitepress/local.js.dist

This file was deleted.

65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,71 @@ The data files live in the base `/data` directory. Each file attempts to be
self-documenting, but they are all essentially large JSON objects. Developers
should need to know basically no JavaScript to be able to edit the files.

### VitePress Path Overrides

Various paths used for VitePress static generation can be overridden using
the `dovecot` object in the `themeConfig` VitePress configuration setting.

#### data_paths

Allows custom mapping of data sources.

It is used by the VitePress data loaders to determine what data to
load for export.

Keys are data identifiers, Values are location RELATIVE TO `<base>/lib`
DIRECTORY.

#### man_includes

A list of additional paths (other than the `include/` directory of the man
folder) where include files can live.

#### man_paths

A listing of paths containing man files.
Paths are relative to project base.

Supports fast-glob: https://github.com/mrmlnc/fast-glob#pattern-syntax

#### markdown_extend

An object containing callbacks that enable additional labels to support in
Dovecot-specific markdown processing (i.e. [[xyz,...]]).

##### open

Opening tag function. Returns opening tag.

Example: `open: (mode, parts, opts, env) => { return '' }`

##### body

Body function. Returns body text.

Example: `body: (mode, env) => { return '' }`

##### close

Close tag function. Returns closing tag.

Example: `close: (mode, env) => { return '' }`

#### plugin_paths

A listing of paths containing plugin files.
Paths are relative to project base.

Supports fast-glob: https://github.com/mrmlnc/fast-glob#pattern-syntax

#### watch_paths

An array of file patterns to watch to refresh data loaders in dev mode.
See: https://vitepress.dev/guide/data-loading#data-from-local-files
Paths are relative to project base.

Supports fast-glob: https://github.com/mrmlnc/fast-glob#pattern-syntax

### Dovecot Markdown Extensions

Markdown has been extended to allow various Dovecot-specific tasks to be
Expand Down
7 changes: 3 additions & 4 deletions lib/data/doveadm.data.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { doveadm_arg_types, doveadm_flag_types, getDoveadmCmdLine } from '../doveadm.js'
import { getVitepressMd } from '../markdown.js'
import { loadData, normalizeArrayData, watchFiles } from '../utility.js'
import { addWatchPaths, loadData, normalizeArrayData } from '../utility.js'
import slugify from '@sindresorhus/slugify'

const doveadm_userargs = {
Expand Down Expand Up @@ -147,11 +147,10 @@ async function normalizeDoveadm(doveadm) {
}
}

export default {
watch: await watchFiles(),
export default addWatchPaths({
async load() {
return await normalizeDoveadm(
structuredClone((await loadData('doveadm')).doveadm)
)
}
}
})
7 changes: 3 additions & 4 deletions lib/data/event_categories.data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getVitepressMd } from '../markdown.js'
import { loadData, watchFiles } from '../utility.js'
import { addWatchPaths, loadData } from '../utility.js'

async function normalizeEventCategories(categories) {
const md = await getVitepressMd()
Expand All @@ -11,11 +11,10 @@ async function normalizeEventCategories(categories) {
return categories
}

export default {
watch: await watchFiles(),
export default addWatchPaths({
async load() {
return await normalizeEventCategories(
structuredClone((await loadData('event_categories')).categories)
)
}
}
})
7 changes: 3 additions & 4 deletions lib/data/event_reasons.data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getVitepressMd } from '../markdown.js'
import { loadData, watchFiles } from '../utility.js'
import { addWatchPaths, loadData } from '../utility.js'

async function normalizeEventReasons(reasons) {
const md = await getVitepressMd()
Expand All @@ -11,11 +11,10 @@ async function normalizeEventReasons(reasons) {
return reasons
}

export default {
watch: await watchFiles(),
export default addWatchPaths({
async load() {
return await normalizeEventReasons(
structuredClone((await loadData('event_reasons')).reasons)
)
}
}
})
7 changes: 3 additions & 4 deletions lib/data/events.data.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { loadData, normalizeArrayData, watchFiles } from '../utility.js'
import { addWatchPaths, loadData, normalizeArrayData } from '../utility.js'
import { getVitepressMd } from '../markdown.js'

/* Take the events list and normalize entries and process inheritance. */
Expand Down Expand Up @@ -124,8 +124,7 @@ async function normalizeEvents(events, global_inherits, inherits) {
return events
}

export default {
watch: await watchFiles(),
export default addWatchPaths({
async load() {
const data = await loadData('events')
return await normalizeEvents(
Expand All @@ -134,4 +133,4 @@ export default {
structuredClone(data.inherits)
)
}
}
})
7 changes: 3 additions & 4 deletions lib/data/lua.data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getVitepressMd } from '../markdown.js'
import { loadData, watchFiles } from '../utility.js'
import { addWatchPaths, loadData } from '../utility.js'

async function normalizeLuaConstants(lua) {
const md = await getVitepressMd()
Expand Down Expand Up @@ -62,8 +62,7 @@ async function normalizeLuaVariables(lua) {
return out
}

export default {
watch: await watchFiles(),
export default addWatchPaths({
async load() {
const data = await(loadData('lua'))

Expand All @@ -73,4 +72,4 @@ export default {
variables: await normalizeLuaVariables(data.lua_variables)
}
}
}
})
7 changes: 3 additions & 4 deletions lib/data/settings.data.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { loadData, normalizeArrayData, watchFiles } from '../utility.js'
import { addWatchPaths, loadData, normalizeArrayData } from '../utility.js'
import { getVitepressMd } from '../markdown.js'

async function normalizeSettings(settings) {
Expand Down Expand Up @@ -69,11 +69,10 @@ async function normalizeSettings(settings) {
return data
}

export default {
watch: await watchFiles(),
export default addWatchPaths({
async load() {
return await normalizeSettings(
structuredClone((await loadData('settings')).settings)
)
}
}
})
Loading
Loading