{ "info": { "author": "Md. Jahidul Hamid", "author_email": "jahidulhamid@yahoo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Text Processing :: Filters", "Topic :: Text Processing :: Markup" ], "description": "[](https://travis-ci.org/neurobin/mdx_wikilink_plus)\n\nConverts wikilinks (`[[wikilink]]`) to relative links. 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).\n\n**You should not use markdown.extensions.wikilinks along with this one. This extension is designed to provide the functionalities of markdown.extensions.wikilinks along with some extra features. Choose either one.**\n\n# Install\n\n```bash\npip install mdx_wikilink_plus\n```\n\n# Wikilink syntax\n\nThe geneal formats are:\n\n1. Without explicit label: `[[wikilink]]`\n2. With explicit label: `[[ link | label ]]`\n\n# Usage\n\n```python\ntext = \"[[wikilink]]\"\nmd = markdown.Markdown(extensions=['mdx_wikilink_plus'])\nhtml = md.convert(text)\n```\n\n# Quick examples\n\n`[[/path/to/file-name]]` will become:\n\n```html\n
\n```\n\n`[[https://www.example.com/example-tutorial]]` will become:\n\n```html\n\n```\n\nand `[[https://www.example.com/?a=b&b=c]]` will become:\n\n```html\n\n```\n\n\n## Configuration\n\nThe configuration options are:\n\nConfig param | Default | Details\n------------ | ------- | -------\nbase_url | `''` | Prepended to the file_path part of the URL. A `/` at the end of the base_url will be handled intelligently.\nend_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 `.html` and the wikilink provided is `[[/path/to/myfile.html]]`, then the URL will be `/path/to/myfile.html` not `/path/to/myfile.html.html`.\nurl_whitespace | `'-'` | Replace all whitespace in the file_path path with this character (string) when building the URL.\nlabel_case | `'titlecase'` | Choose case of the label. Available options: titlecase, capitalize, none. Capitalize will capitalize the first character only.\nhtml_class | `'wikilink'` | Set custom HTML classes on the anchor tag. It does not add classes rather it resets any previously set value.\nbuild_url | `mdx_wikilink_plus.build_url` | A callable that returns the URL string. [Default build_url callable](#the-build_url-callable)\n\n**None of the configs apply on absolute URLs except html_class and build_url. (Yes, label_case won't work either)**\n\n### Configuration through meta data\n\nConfiguration can also be passed through metadata (markdown.extensions.meta).\n\nWe recognize the following template:\n\n```md\nwiki_base_url: /static/\nwiki_end_url: \nwiki_url_whitespace: _\nwiki_label_case: capitalize\nwiki_html_class: wikilink\n\nThe first line of the document\n```\n\n\n### An example with configuration:\n\n\n```python\nmd_configs = {\n 'mdx_wikilink_plus': {\n 'base_url': '/static',\n 'end_url': '.html',\n 'url_whitespace': '-',\n 'label_case': 'titlecase',\n 'html_class': 'a-custom-class',\n #'build_url': build_url, # A callable\n # all of the above config params are optional\n },\n }\n\n\ntext = \"\"\"\n[[/path/to/file-name]]\n\n[[/path/to/file name/?a=b&b=c]]\n\"\"\"\n\n\nmd = markdown.Markdown(extensions=['mdx_wikilink_plus'], extension_configs=md_configs)\nprint(md.convert(text))\n```\n\nThe output will be:\n\n```html\n\n\n```\n\n!!! info\n `end_url` is added at the end of the file-path part in the URL.\n\n\n# More examples\n\nOur test markdown:\n\n```md\n[[wikilink]] `[[wikilink]]`\n\n[[/path/to/file name]]\n\n[[/path/to/file_name]]\n\n[[/path/to/file-name]]\n\n[[/path/to/file name/?a=b&b=c]]\n\n[[/path/to/file name.html]]\n\n[[/path/to/file name.html?a=b&b=c]]\n\n[[https://www.example.com/?]]\n\n[[https://www.example.com/?a=b&b=c]]\n\n[[https://www.example.com/example-tutorial]]\n\n[[https://www.example.com/example-tutorial | Example Tutorial]]\n```\n\n## Output without any config\n\n```html\nWikilink [[wikilink]]
Wikilink [[wikilink]]
Wikilink [[wikilink]]