mdx-gitlab-links


Namemdx-gitlab-links JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryAn extension to Python-Markdown which adds support for GitLab-specific references.
upload_time2024-11-17 19:48:34
maintainerNone
docs_urlNone
authorThibaud Gambier
requires_python>=3.9
licenseBSD 3-Clause License Copyright (c) 2024, Thibaud Gambier Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords markdown python-markdown gitlab
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python-Markdown GitLab-Links Extension

An extension to [Python-Markdown](https://github.com/Python-Markdown/markdown)
which adds support for [GitLab-specific references](https://docs.gitlab.com/ee/user/markdown.html#gitlab-specific-references).
Inspired by [github-links](https://github.com/Python-Markdown/github-links/tree/master).

## Installation

```text
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.

```python
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.

```python
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](https://gitlab.com/group/subgroup/project/-/merge_requests/123 "GitLab Merge Request group/subgroup/project/123") |
| `proj!123`          | `https://gitlab.com/group/subgroup/proj/123`    | [proj/!123](https://gitlab.com/group/subgroup/proj/-/merge_requests/123 "GitLab Merge Request group/subgroup/proj/123") |
| `grp/sub/proj!123`  | `https://gitlab.com/grp/sub/proj/123`           | [grp/sub/proj/!123](https://gitlab.com/grp/sub/proj/-/merge_requests/123 "GitLab Merge Request grp/sub/proj/123") |
| `\!123`             |                                                 | !123 |
| `proj\!123`         |                                                 | proj!123 |
| `grp/sub/proj\!123` |                                                 | grp/sub/proj!123 |

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mdx-gitlab-links",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "markdown, python-markdown, gitlab",
    "author": "Thibaud Gambier",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/72/e0/3701e317f72b8aaa4250baccf883e51d29e8a754cf754fcf84bd3a916de7/mdx_gitlab_links-0.1.0.tar.gz",
    "platform": null,
    "description": "# Python-Markdown GitLab-Links Extension\n\nAn extension to [Python-Markdown](https://github.com/Python-Markdown/markdown)\nwhich adds support for [GitLab-specific references](https://docs.gitlab.com/ee/user/markdown.html#gitlab-specific-references).\nInspired by [github-links](https://github.com/Python-Markdown/github-links/tree/master).\n\n## Installation\n\n```text\npip install mdx-gitlab-links\n```\n\n## Usage\n\nTo use the extension simply include its name in the list of extensions\npassed to Python-Markdown.\n\nTo set configuration options,\nyou may pass them to Markdown's `exension_configs` keyword.\n\n```python\nimport markdown\n\nmarkdown.markdown(\n    src,\n    extensions=[\"mdx_gitlab_links\"],\n    extension_configs={\n        \"mdx_gitlab_links\": {\n            \"domain\": \"https://gitlab.mydomain.com\",\n            \"group\": \"my-group/my-subgroup\",\n            \"project\": \"my-project\",\n        },\n    },\n)\n```\n\nOr you may import and pass the configs directly\nto an instance of the `mdx_gitlab_links.GitlabLinks` class.\n\n```python\nimport markdown\nfrom mdx_gitlab_links import GitlabLinks\n\nextension = GitlabLinks(\n    domain=\"https://gitlab.mydomain.com\",\n    group=\"my-group/my-subgroup\",\n    project=\"my-project\",\n)\n\nmarkdown.markdown(src, extensions=[extension])\n```\n\nThe following configurations options are available:\n\n- **domain**:\n    The GitLab domain or Enterprise Server domain.\n    Default to `https://gitlab.com`.\n- **group**:\n    The GitLab user or group (and subgroup).\n- **project**:\n    The GitLab repository name.\n\n## Syntax\n\nAll links are assigned the `gl-link` class as well\nas a class unique to that type of link.\nSee each type for the specific class assigned.\n\n### Merge Requests\n\nAll merge requests links are assigned the `gl-mr` class.\n\nThe following table provides various examples\n(with the defaults set as `group='group/subgroup'`, `project='project'`):\n\n| input               | href                                            | render |\n|---------------------|-------------------------------------------------|--------|\n| `!123`              | `https://gitlab.com/group/subgroup/project/123` | [!123](https://gitlab.com/group/subgroup/project/-/merge_requests/123 \"GitLab Merge Request group/subgroup/project/123\") |\n| `proj!123`          | `https://gitlab.com/group/subgroup/proj/123`    | [proj/!123](https://gitlab.com/group/subgroup/proj/-/merge_requests/123 \"GitLab Merge Request group/subgroup/proj/123\") |\n| `grp/sub/proj!123`  | `https://gitlab.com/grp/sub/proj/123`           | [grp/sub/proj/!123](https://gitlab.com/grp/sub/proj/-/merge_requests/123 \"GitLab Merge Request grp/sub/proj/123\") |\n| `\\!123`             |                                                 | !123 |\n| `proj\\!123`         |                                                 | proj!123 |\n| `grp/sub/proj\\!123` |                                                 | grp/sub/proj!123 |\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2024, Thibaud Gambier  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "An extension to Python-Markdown which adds support for GitLab-specific references.",
    "version": "0.1.0",
    "project_urls": {
        "Changelog": "https://github.com/tahv/gitlab-links/blob/main/CHANGELOG.md",
        "Homepage": "https://pypi.org/project/mdx-gitlab-links",
        "Issue Tracker": "https://github.com/tahv/gitlab-links/issues",
        "Repository": "https://github.com/tahv/gitlab-links"
    },
    "split_keywords": [
        "markdown",
        " python-markdown",
        " gitlab"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f59edddbcbd0af179cf2ce0a1b1747bcf11bcb8972a6ab5eda03da17eddd1c17",
                "md5": "587d572214f13a9cfa07277157d70919",
                "sha256": "95a0fd757421b0c19e4e60b279941e81e1e5810e9409a8cab0f7dec405164d10"
            },
            "downloads": -1,
            "filename": "mdx_gitlab_links-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "587d572214f13a9cfa07277157d70919",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5569,
            "upload_time": "2024-11-17T19:48:32",
            "upload_time_iso_8601": "2024-11-17T19:48:32.338055Z",
            "url": "https://files.pythonhosted.org/packages/f5/9e/dddbcbd0af179cf2ce0a1b1747bcf11bcb8972a6ab5eda03da17eddd1c17/mdx_gitlab_links-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "72e03701e317f72b8aaa4250baccf883e51d29e8a754cf754fcf84bd3a916de7",
                "md5": "f325ad3308217fc9853374797a51e57d",
                "sha256": "6fd756e0127296e06dabe373304879c08126ca5734a7243aaa80be7927cc5c3b"
            },
            "downloads": -1,
            "filename": "mdx_gitlab_links-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f325ad3308217fc9853374797a51e57d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 32630,
            "upload_time": "2024-11-17T19:48:34",
            "upload_time_iso_8601": "2024-11-17T19:48:34.218732Z",
            "url": "https://files.pythonhosted.org/packages/72/e0/3701e317f72b8aaa4250baccf883e51d29e8a754cf754fcf84bd3a916de7/mdx_gitlab_links-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-17 19:48:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tahv",
    "github_project": "gitlab-links",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mdx-gitlab-links"
}
        
Elapsed time: 1.01306s