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 |
Metadata
Release files for mdx-gitlab-links 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mdx_gitlab_links-0.1.0.tar.gz | 32.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mdx_gitlab_links-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.2 kB
Release files / mdx_gitlab_links-0.1.0.tar.gz
| Download URL | mdx_gitlab_links-0.1.0.tar.gz |
|---|---|
| Size | 32.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6fd756e0127296e06dabe373304879c08126ca5734a7243aaa80be7927cc5c3b
|
|
BLAKE2b-256 checksum How to use checksums |
72e03701e317f72b8aaa4250baccf883e51d29e8a754cf754fcf84bd3a916de7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2024.
Transparency logRelease files / mdx_gitlab_links-0.1.0-py3-none-any.whl
| Download URL | mdx_gitlab_links-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95a0fd757421b0c19e4e60b279941e81e1e5810e9409a8cab0f7dec405164d10
|
|
BLAKE2b-256 checksum How to use checksums |
f59edddbcbd0af179cf2ce0a1b1747bcf11bcb8972a6ab5eda03da17eddd1c17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2024.
Transparency log