File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,13 @@ Paths are relative to project base.
219219
220220Supports fast-glob: https://github.com/mrmlnc/fast-glob#pattern-syntax
221221
222+ #### url_rewrite
223+
224+ A callback where Markdown generated URLs can be rewritten.
225+ Function is called the original URL and returns the (modified) URL.
226+
227+ Example: ` url_rewrite: (url) => { return url + '.foo' } `
228+
222229#### watch_paths
223230
224231An 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