An extension to Python-Markdown which adds support for GitLab-specific references.
Project description
Python-Markdown GitLab-Links Extension
An extension to Python-Markdown which adds support for GitLab-specific references. Inspired by github-links.
Installation
pip install mdx-gitlab-links
Usage
To use the extension simply include its name in the list of extensions passed to Python-Markdown.
To set configuration options,
you may pass them to Markdown's exension_configs
keyword.
import markdown
markdown.markdown(
src,
extensions=["mdx_gitlab_links"],
extension_configs={
"mdx_gitlab_links": {
"domain": "https://gitlab.mydomain.com",
"group": "my-group/my-subgroup",
"project": "my-project",
},
},
)
Or you may import and pass the configs directly
to an instance of the mdx_gitlab_links.GitlabLinks
class.
import markdown
from mdx_gitlab_links import GitlabLinks
extension = GitlabLinks(
domain="https://gitlab.mydomain.com",
group="my-group/my-subgroup",
project="my-project",
)
markdown.markdown(src, extensions=[extension])
The following configurations options are available:
- domain:
The GitLab domain or Enterprise Server domain.
Default to
https://gitlab.com
. - group: The GitLab user or group (and subgroup).
- project: The GitLab repository name.
Syntax
All links are assigned the gl-link
class as well
as a class unique to that type of link.
See each type for the specific class assigned.
Merge Requests
All merge requests links are assigned the gl-mr
class.
The following table provides various examples
(with the defaults set as group='group/subgroup'
, project='project'
):
input | href | render |
---|---|---|
!123 |
https://gitlab.com/group/subgroup/project/123 |
!123 |
proj!123 |
https://gitlab.com/group/subgroup/proj/123 |
proj/!123 |
grp/sub/proj!123 |
https://gitlab.com/grp/sub/proj/123 |
grp/sub/proj/!123 |
\!123 |
!123 | |
proj\!123 |
proj!123 | |
grp/sub/proj\!123 |
grp/sub/proj!123 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mdx_gitlab_links-0.1.0.tar.gz
.
File metadata
- Download URL: mdx_gitlab_links-0.1.0.tar.gz
- Upload date:
- Size: 32.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fd756e0127296e06dabe373304879c08126ca5734a7243aaa80be7927cc5c3b |
|
MD5 | f325ad3308217fc9853374797a51e57d |
|
BLAKE2b-256 | 72e03701e317f72b8aaa4250baccf883e51d29e8a754cf754fcf84bd3a916de7 |
Provenance
The following attestation bundles were made for mdx_gitlab_links-0.1.0.tar.gz
:
Publisher:
release.yml
on tahv/gitlab-links
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
mdx_gitlab_links-0.1.0.tar.gz
- Subject digest:
6fd756e0127296e06dabe373304879c08126ca5734a7243aaa80be7927cc5c3b
- Sigstore transparency entry: 149372855
- Sigstore integration time:
- Predicate type:
File details
Details for the file mdx_gitlab_links-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: mdx_gitlab_links-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95a0fd757421b0c19e4e60b279941e81e1e5810e9409a8cab0f7dec405164d10 |
|
MD5 | 587d572214f13a9cfa07277157d70919 |
|
BLAKE2b-256 | f59edddbcbd0af179cf2ce0a1b1747bcf11bcb8972a6ab5eda03da17eddd1c17 |
Provenance
The following attestation bundles were made for mdx_gitlab_links-0.1.0-py3-none-any.whl
:
Publisher:
release.yml
on tahv/gitlab-links
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
mdx_gitlab_links-0.1.0-py3-none-any.whl
- Subject digest:
95a0fd757421b0c19e4e60b279941e81e1e5810e9409a8cab0f7dec405164d10
- Sigstore transparency entry: 149372858
- Sigstore integration time:
- Predicate type: