File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export const dovecotConfig = {
3131 plugin_paths : [
3232 'docs/core/plugins/*.md'
3333 ] ,
34+ url_rewrite : false ,
3435 watch_paths : [
3536 'docs/**/*.md' ,
3637 'docs/**/*.inc' ,
Original file line number Diff line number Diff line change @@ -232,6 +232,13 @@ Paths are relative to project base.
232232
233233Supports fast-glob: https://github.com/mrmlnc/fast-glob#pattern-syntax
234234
235+ #### url_rewrite
236+
237+ A callback where Markdown generated URLs can be rewritten.
238+ Function is called the original URL and returns the (modified) URL.
239+
240+ Example: ` url_rewrite: (url) => { return url + '.foo' } `
241+
235242#### watch_paths
236243
237244An array of file patterns to watch to refresh data loaders in dev mode.
Original file line number Diff line number Diff line change @@ -435,8 +435,14 @@ function dovecot_markdown(md, opts) {
435435 }
436436
437437 function resolveURL ( url ) {
438- return ( opts . base . endsWith ( '/' ) ? opts . base . slice ( 0 , - 1 ) : opts . base ) +
438+ if ( ! ( 'url_rewrite' in opts ) ) {
439+ opts . url_rewrite = dovecotSetting ( 'url_rewrite' )
440+ }
441+
442+ const new_url =
443+ ( opts . base . endsWith ( '/' ) ? opts . base . slice ( 0 , - 1 ) : opts . base ) +
439444 '/' + url
445+ return ( opts . url_rewrite ) ? opts . url_rewrite ( new_url ) : new_url
440446 }
441447
442448 md . inline . ruler . after ( 'emphasis' , 'dovecot_brackets' , process_brackets )
You can’t perform that action at this time.
0 commit comments