@@ -3,7 +3,7 @@ import fg from 'fast-glob'
33import deflistPlugin from 'markdown-it-deflist'
44import path from 'path'
55import { createMarkdownRenderer } from 'vitepress'
6- import { frontmatterIter, loadData, manFiles , markdownExtension, pluginFiles, resolveURL } from './utility.js'
6+ import { dovecotSetting, frontmatterIter, loadData , markdownExtension, pluginFiles, resolveURL } from './utility.js'
77
88let md_conf = null
99export async function initDovecotMd(base) {
@@ -17,12 +17,6 @@ export async function initDovecotMd(base) {
1717 doveadm: (await loadData('doveadm')).doveadm,
1818 events: (await loadData('events')).events,
1919 linkoverrides: (await loadData('links_overrides')).links_overrides,
20- man: (await manFiles()).flatMap((x) => {
21- return fg.sync(x).map((y) => {
22- const str = path.basename(y)
23- return str.substring(0, str.indexOf('.'))
24- })
25- }),
2620 plugins: (await pluginFiles()).flatMap((x) =>
2721 fg.sync(x).map((y) => path.basename(y, '.md'))
2822 ),
@@ -219,6 +213,8 @@ function dovecot_markdown(md, opts) {
219213 hash = parts[2] ? parts[2] : false;
220214 env.args = parts[3] ? parts[3] : 1;
221215
216+ initManFiles()
217+
222218 if (!opts.man.includes(env.inner)) {
223219 handle_error('man link missing: ' + env.inner)
224220 return '<a><code>'
@@ -426,6 +422,17 @@ function dovecot_markdown(md, opts) {
426422 opts.dovecotlinks = { ...links, ...opts.linkoverrides }
427423 }
428424
425+ function initManFiles() {
426+ if (!opts.man) {
427+ opts.man = dovecotSetting('man_paths').flatMap((x) => {
428+ return fg.sync(x).map((y) => {
429+ const str = path.basename(y)
430+ return str.substring(0, str.indexOf('.'))
431+ })
432+ })
433+ }
434+ }
435+
429436 md.inline.ruler.after('emphasis', 'dovecot_brackets', process_brackets)
430437 md.renderer.rules.dovecot_open = dovecot_open
431438 md.renderer.rules.dovecot_body = dovecot_body
0 commit comments