A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/tahv/gitlab-links below:

tahv/gitlab-links: Python-Markdown GitLab Links Extension

Python-Markdown GitLab-Links Extension

An extension to Python-Markdown which adds support for GitLab-specific references. Inspired by github-links.

pip install mdx-gitlab-links

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:

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.

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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4