Package: mdx-wikilink-plus
Converts wikilinks ([[wikilink]]) to relative links, including support forGitHub image variant. Absolute links are kept as is (with an automatic label made from the file path part in the URL if label is not given explicitly).You must not use this extension with markdown.extensions.wikilinks. This extension is designed to provide the functionalities of markdown.extensions.wikilinks with some extra features. Choose either one.Installpipinstallmdx_wikilink_plusWikilink syntaxThe geneal formats are:Without explicit label:[[wikilink]]With explicit label:[[ link | label ]]only supported for links not imagesImage:[[image.ext]]supports: .png, .jpg, .jpeg or .gifImage alt text:[[image.ext|alt=alternate text]]Usageimport markdownthen:text="[[wikilink]]"md=markdown.Markdown(extensions=['mdx_wikilink_plus'])html=md.convert(text)Quick examples[[/path/to/file-name]]will become:<p><aclass="wikilink"href="/path/to/file-name">File Name</a></p>[[/path/to/file name.jpg| alt= alt text]]will become:<p><imgalt="alt text"class="wikilink-image"src="/path/to/file-name.jpg"/></p>[[https://www.example.com/example-tutorial]]will become:<p><aclass="wikilink"href="https://www.example.com/example-tutorial">Example Tutorial</a></p>and[[https://www.example.com/?a=b&b=c]]will become:<p><aclass="wikilink"href="https://www.example.com/?a=b&amp;b=c">www.example.com</a></p>ConfigurationThe configuration options are:Config paramDefaultDetailsbase_url''Prepended to the file_path part of the URL. A/at the end of the base_url will be handled intelligently.end_url''Appended to the file_path part of the URL. If end_url is given (non-empty), then any/at the end of the file_path part in the URL is removed. If the end_url matches the extension of the file_path part, it will be ignored, for example, if end_url is.htmland the wikilink provided is[[/path/to/myfile.html]], then the URL will be/path/to/myfile.htmlnot/path/to/myfile.html.html.url_whitespace'-'Replace all whitespace in the file_path path with this character (string) when building the URL.url_case'none'Choose case in the file_path. Available options: lowercase, uppercase.label_case'titlecase'Choose case of the label. Available options: titlecase, capitalize, none. Capitalize will capitalize the first character only.html_class'wikilink'Set custom HTML classes on the anchor tag. It does not add classes rather it resets any previously set value.image_class'wikilink-image'Set custom HTML classes on the anchor tag. It does not add classes rather it resets any previously set value.build_urlmdx_wikilink_plus.build_urlA callable that returns the URL string.Default build_url callableNone of the configs apply on absolute URLs except html_class and build_url. (Yes, label_case won't work either)Configuration through meta dataConfiguration can also be passed through metadata (markdown.extensions.meta). Meta-data consists of a series of keywords and values which must be defined at the beginning of a markdown document.The following example uses recognised metadata parameters:wiki_base_url: /static/
wiki_end_url: 
wiki_url_whitespace: _
wiki_url_case: lowercase
wiki_label_case: capitalize
wiki_html_class: wiki-link
wiki_image_class: wiki-image

This is the first paragraph of the document.An example with configuration:md_configs={'mdx_wikilink_plus':{'base_url':'/static','end_url':'.html','url_case':'lowercase','html_class':'a-custom-class',#'build_url': build_url, # A callable# all of the above config params are optional},}text="""[[Page Name]][[/path/to/file-name.png|alt=demo image]][[/path/to/file name/?a=b&b=c]]"""md=markdown.Markdown(extensions=['mdx_wikilink_plus'],extension_configs=md_configs)print(md.convert(text))The output will be:<p><aclass="a-custom-class"href="/static/page-name.html">Page Name</a></p><p><imgalt="demo image"class="wikilink-image"src="/static/path/to/file-name.png"/></p><p><aclass="a-custom-class"href="/static/path/to/file-name.html?a=b&amp;b=c">File Name</a></p>!!! infoend_urlis added at the end of the file-path part in the URL.More examplesMore examples are given in thetest markdown codewhich demonstrates defaults with no config, a config, meta and build_url.With meta (markdown.extensions.meta)If meta is used it must be added to the start of the markdown. eg:wiki_base_url: /local
wiki_url_whitespace: _
wiki_url_case: lowercase
wiki_label_case: capitalize
wiki_html_class: wiki-lnk
wiki_image_class: wiki-imgThe build_url callableYou can view the defaultbuild_urlfunction which can be customized in python.