{"id":28640655,"url":"https://github.com/neurobin/mdx_wikilink_plus","last_synced_at":"2025-06-12T20:07:59.771Z","repository":{"id":46333769,"uuid":"149429642","full_name":"neurobin/mdx_wikilink_plus","owner":"neurobin","description":"A wikilink extension for Python Markdown","archived":false,"fork":false,"pushed_at":"2022-07-26T06:02:00.000Z","size":100,"stargazers_count":16,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-05T13:49:29.763Z","etag":null,"topics":["extension","python-markdown","wikilink","wikilink-plus"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neurobin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"neurobin","liberapay":"neurobin","ko_fi":"neurobin","issuehunt":"neurobin","open_collective":"neurobin","otechie":"neurobin"}},"created_at":"2018-09-19T09:56:17.000Z","updated_at":"2024-08-12T09:28:07.000Z","dependencies_parsed_at":"2022-07-22T06:02:02.822Z","dependency_job_id":null,"html_url":"https://github.com/neurobin/mdx_wikilink_plus","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/neurobin/mdx_wikilink_plus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurobin%2Fmdx_wikilink_plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurobin%2Fmdx_wikilink_plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurobin%2Fmdx_wikilink_plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurobin%2Fmdx_wikilink_plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neurobin","download_url":"https://codeload.github.com/neurobin/mdx_wikilink_plus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurobin%2Fmdx_wikilink_plus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259522114,"owners_count":22870449,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["extension","python-markdown","wikilink","wikilink-plus"],"created_at":"2025-06-12T20:07:58.836Z","updated_at":"2025-06-12T20:07:59.764Z","avatar_url":"https://github.com/neurobin.png","language":"Python","funding_links":["https://patreon.com/neurobin","https://liberapay.com/neurobin","https://ko-fi.com/neurobin","https://issuehunt.io/r/neurobin","https://opencollective.com/neurobin","https://otechie.com/neurobin"],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/neurobin/mdx_wikilink_plus.svg?branch=release)](https://travis-ci.org/neurobin/mdx_wikilink_plus)\n\nConverts wikilinks (`[[wikilink]]`) to relative links, including support for [GitHub image variant](https://docs.github.com/en/free-pro-team@latest/github/building-a-strong-community/editing-wiki-content#linking-to-images-in-a-repository). 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 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.**\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    - only supported for links not images\n3. Image: `[[image.ext]]`\n    - supports: .png, .jpg, .jpeg or .gif\n4. Image alt text: `[[image.ext|alt=alternate text]]`\n\n# Usage\n\n`import markdown` then:\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\u003cp\u003e\u003ca class=\"wikilink\" href=\"/path/to/file-name\"\u003eFile Name\u003c/a\u003e\u003c/p\u003e\n```\n\n`[[/path/to/file name.jpg| alt= alt text]]` will become:\n\n```html\n\u003cp\u003e\u003cimg alt=\"alt text\" class=\"wikilink-image\" src=\"/path/to/file-name.jpg\" /\u003e\u003c/p\u003e\n```\n\n`[[https://www.example.com/example-tutorial]]` will become:\n\n```html\n\u003cp\u003e\u003ca class=\"wikilink\" href=\"https://www.example.com/example-tutorial\"\u003eExample Tutorial\u003c/a\u003e\u003c/p\u003e\n```\n\nand `[[https://www.example.com/?a=b\u0026b=c]]` will become:\n\n```html\n\u003cp\u003e\u003ca class=\"wikilink\" href=\"https://www.example.com/?a=b\u0026amp;b=c\"\u003ewww.example.com\u003c/a\u003e\u003c/p\u003e\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.\nurl_case | `'none'` | Choose case in the file_path. Available options: lowercase, uppercase.\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.\nimage_class | `'wikilink-image'` | 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](https://python-markdown.github.io/extensions/meta_data/)). Meta-data consists of a series of keywords and values which must be defined at the beginning of a markdown document.\n\nThe following example uses recognised metadata parameters:\n\n```md\nwiki_base_url: /static/\nwiki_end_url: \nwiki_url_whitespace: _\nwiki_url_case: lowercase\nwiki_label_case: capitalize\nwiki_html_class: wiki-link\nwiki_image_class: wiki-image\n\nThis is the first paragraph 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_case': 'lowercase',\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[[Page Name]]\n\n[[/path/to/file-name.png|alt=demo image]]\n\n[[/path/to/file name/?a=b\u0026b=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\u003cp\u003e\u003ca class=\"a-custom-class\" href=\"/static/page-name.html\"\u003ePage Name\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003cimg alt=\"demo image\" class=\"wikilink-image\" src=\"/static/path/to/file-name.png\" /\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca class=\"a-custom-class\" href=\"/static/path/to/file-name.html?a=b\u0026amp;b=c\"\u003eFile Name\u003c/a\u003e\u003c/p\u003e\n```\n\n!!! info\n    `end_url` is added at the end of the file-path part in the URL.\n\n-----\n\n# More examples\n\nMore examples are given in the [test markdown code](https://github.com/neurobin/mdx_wikilink_plus/blob/master/mdx_wikilink_plus/test.py) which demonstrates defaults with no config, a config, meta and build_url.\n\n## With meta (`markdown.extensions.meta`)\n\nIf meta is used it must be added to the start of the markdown. eg:\n\n```md\nwiki_base_url: /local\nwiki_url_whitespace: _\nwiki_url_case: lowercase\nwiki_label_case: capitalize\nwiki_html_class: wiki-lnk\nwiki_image_class: wiki-img\n```\n\n# The build_url callable\n\nYou can view the default [build_url](https://github.com/neurobin/mdx_wikilink_plus/blob/master/mdx_wikilink_plus/mdx_wikilink_plus.py#L36) function which can be customized in python.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneurobin%2Fmdx_wikilink_plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneurobin%2Fmdx_wikilink_plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneurobin%2Fmdx_wikilink_plus/lists"}