django-mermaid


Namedjango-mermaid JSON
Version 0.0.7 PyPI version JSON
download
home_pagehttps://github.com/pysnippet/django-mermaid
SummaryDjango template tag for rendering mermaid diagrams.
upload_time2023-06-02 16:54:30
maintainer
docs_urlNone
authorArtyom Vancyan
requires_python>=3.6
licenseMIT
keywords python django mermaid tag graph jinja diagram template
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django Mermaid <img src="https://github.com/pysnippet.png" align="right" height="64" />

[![PyPI](https://img.shields.io/pypi/v/django-mermaid.svg)](https://pypi.org/project/django-mermaid/)
[![Python](https://img.shields.io/pypi/pyversions/django-mermaid.svg?logoColor=white)](https://pypi.org/project/django-mermaid/)
[![Django](https://img.shields.io/badge/django-1.11%20|%202.0%20|%203.0%20|%204.0%20|%204.2-0C4B33)](https://pypi.org/project/django-mermaid/)
[![License](https://img.shields.io/pypi/l/django-mermaid.svg)](https://github.com/pysnippet/django-mermaid/blob/master/LICENSE)
[![Tests](https://github.com/pysnippet/django-mermaid/actions/workflows/tests.yml/badge.svg)](https://github.com/pysnippet/django-mermaid/actions/workflows/tests.yml)

Mermaid is a JavaScript-based diagramming and charting tool that renders Markdown-inspired text definitions to create
and modify diagrams dynamically. And Django Mermaid aims to use mermaid diagrams in Django templates.

## Installation

```shell
python -m pip install django-mermaid
```

## Configuration

Add the `django_mermaid.apps.MermaidConfig` to your `INSTALLED_APPS` in your Django project's **settings.py** file.

```python
INSTALLED_APPS = [
    ...,  # other apps
    'django_mermaid.apps.MermaidConfig',
]
```

## Usage

After you configure the `INSTALLED_APPS`, you will be able to load the `mermaid` in your template and use the template
tag for rendering mermaid diagrams.

```jinja2
{% load mermaid %}
{% mermaid "graph LR; A-->B;" %}
```

### Mermaid version

By default, Django Mermaid uses the **9.4.3** version of mermaid. However, if you want to use a specific version of
mermaid, you can set the `MERMAID_VERSION` variable in your Django project's **settings.py** file.

```python
MERMAID_VERSION = '10.0.3-alpha.1'
```

Make sure the version you specify is available on the [mermaid CDN](https://cdnjs.com/libraries/mermaid), and has
the **mermaid.min.js** file.

### Mermaid theme

To set a default theme for the whole project, set the `MERMAID_THEME` variable in your Django project's **settings.py**
file. However, Django Mermaid uses
the [default](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-default.js) theme of
mermaid by default. Also, check out the mermaid [docs](https://mermaid.js.org/config/theming.html?#theme-variables) for
the available themes.

```python
MERMAID_THEME = 'neutral'
```

Also, you can provide the theme right in the template tag which will dynamically override the value of
the `MERMAID_THEME` variable.

```jinja2
{% mermaid "graph LR; A-->B;" "dark" %}
```

### Mermaid theme variables

You can define your custom theme by overriding the `MERMAID_THEME_VARIABLES` variable. You will need to use
the [base](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-base.js) theme as it is
the only modifiable theme. Check out the mermaid [docs](https://mermaid.js.org/config/theming.html?#theme-variables) for
the complete and up-to-date list of available theme variables.

```python
MERMAID_THEME_VARIABLES = {
    'primaryColor': '#BB2528',
    'primaryTextColor': '#FFF',
}
```

## Contribute

Any contribution is welcome. If you have any ideas or suggestions, feel free to open an issue or a pull request. And
don't forget to add tests for your changes.

## License

Copyright (C) 2023 Artyom Vancyan. [MIT](https://github.com/pysnippet/django-mermaid/blob/master/LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pysnippet/django-mermaid",
    "name": "django-mermaid",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "python,django,mermaid,tag,graph,jinja,diagram,template",
    "author": "Artyom Vancyan",
    "author_email": "artyom@pysnippet.org",
    "download_url": "https://files.pythonhosted.org/packages/82/fe/0c0a07741b814f27e2aff27de5b7ddd53cf641003f74bbaefc256bb6c70c/django-mermaid-0.0.7.tar.gz",
    "platform": "unix",
    "description": "# Django Mermaid <img src=\"https://github.com/pysnippet.png\" align=\"right\" height=\"64\" />\n\n[![PyPI](https://img.shields.io/pypi/v/django-mermaid.svg)](https://pypi.org/project/django-mermaid/)\n[![Python](https://img.shields.io/pypi/pyversions/django-mermaid.svg?logoColor=white)](https://pypi.org/project/django-mermaid/)\n[![Django](https://img.shields.io/badge/django-1.11%20|%202.0%20|%203.0%20|%204.0%20|%204.2-0C4B33)](https://pypi.org/project/django-mermaid/)\n[![License](https://img.shields.io/pypi/l/django-mermaid.svg)](https://github.com/pysnippet/django-mermaid/blob/master/LICENSE)\n[![Tests](https://github.com/pysnippet/django-mermaid/actions/workflows/tests.yml/badge.svg)](https://github.com/pysnippet/django-mermaid/actions/workflows/tests.yml)\n\nMermaid is a JavaScript-based diagramming and charting tool that renders Markdown-inspired text definitions to create\nand modify diagrams dynamically. And Django Mermaid aims to use mermaid diagrams in Django templates.\n\n## Installation\n\n```shell\npython -m pip install django-mermaid\n```\n\n## Configuration\n\nAdd the `django_mermaid.apps.MermaidConfig` to your `INSTALLED_APPS` in your Django project's **settings.py** file.\n\n```python\nINSTALLED_APPS = [\n    ...,  # other apps\n    'django_mermaid.apps.MermaidConfig',\n]\n```\n\n## Usage\n\nAfter you configure the `INSTALLED_APPS`, you will be able to load the `mermaid` in your template and use the template\ntag for rendering mermaid diagrams.\n\n```jinja2\n{% load mermaid %}\n{% mermaid \"graph LR; A-->B;\" %}\n```\n\n### Mermaid version\n\nBy default, Django Mermaid uses the **9.4.3** version of mermaid. However, if you want to use a specific version of\nmermaid, you can set the `MERMAID_VERSION` variable in your Django project's **settings.py** file.\n\n```python\nMERMAID_VERSION = '10.0.3-alpha.1'\n```\n\nMake sure the version you specify is available on the [mermaid CDN](https://cdnjs.com/libraries/mermaid), and has\nthe **mermaid.min.js** file.\n\n### Mermaid theme\n\nTo set a default theme for the whole project, set the `MERMAID_THEME` variable in your Django project's **settings.py**\nfile. However, Django Mermaid uses\nthe [default](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-default.js) theme of\nmermaid by default. Also, check out the mermaid [docs](https://mermaid.js.org/config/theming.html?#theme-variables) for\nthe available themes.\n\n```python\nMERMAID_THEME = 'neutral'\n```\n\nAlso, you can provide the theme right in the template tag which will dynamically override the value of\nthe `MERMAID_THEME` variable.\n\n```jinja2\n{% mermaid \"graph LR; A-->B;\" \"dark\" %}\n```\n\n### Mermaid theme variables\n\nYou can define your custom theme by overriding the `MERMAID_THEME_VARIABLES` variable. You will need to use\nthe [base](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-base.js) theme as it is\nthe only modifiable theme. Check out the mermaid [docs](https://mermaid.js.org/config/theming.html?#theme-variables) for\nthe complete and up-to-date list of available theme variables.\n\n```python\nMERMAID_THEME_VARIABLES = {\n    'primaryColor': '#BB2528',\n    'primaryTextColor': '#FFF',\n}\n```\n\n## Contribute\n\nAny contribution is welcome. If you have any ideas or suggestions, feel free to open an issue or a pull request. And\ndon't forget to add tests for your changes.\n\n## License\n\nCopyright (C) 2023 Artyom Vancyan. [MIT](https://github.com/pysnippet/django-mermaid/blob/master/LICENSE)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Django template tag for rendering mermaid diagrams.",
    "version": "0.0.7",
    "project_urls": {
        "Homepage": "https://github.com/pysnippet/django-mermaid"
    },
    "split_keywords": [
        "python",
        "django",
        "mermaid",
        "tag",
        "graph",
        "jinja",
        "diagram",
        "template"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1467d052157ad0fd65cb2d703399bbb911ba0144870cf4d4c8ec2e19fbb47e72",
                "md5": "86e8573a9f0a0315da6a56f9afed7010",
                "sha256": "e0b6505f809cd9b140f433fc5d5eeff82312cc0f5048d0bb9efe7422042803b9"
            },
            "downloads": -1,
            "filename": "django_mermaid-0.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "86e8573a9f0a0315da6a56f9afed7010",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5568,
            "upload_time": "2023-06-02T16:54:28",
            "upload_time_iso_8601": "2023-06-02T16:54:28.803684Z",
            "url": "https://files.pythonhosted.org/packages/14/67/d052157ad0fd65cb2d703399bbb911ba0144870cf4d4c8ec2e19fbb47e72/django_mermaid-0.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "82fe0c0a07741b814f27e2aff27de5b7ddd53cf641003f74bbaefc256bb6c70c",
                "md5": "27d9040a0755a548d905f511c33edc32",
                "sha256": "8642b109398adb55a5d33485e16254c683ef6764308e2c6911fd71664c124648"
            },
            "downloads": -1,
            "filename": "django-mermaid-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "27d9040a0755a548d905f511c33edc32",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6392,
            "upload_time": "2023-06-02T16:54:30",
            "upload_time_iso_8601": "2023-06-02T16:54:30.949624Z",
            "url": "https://files.pythonhosted.org/packages/82/fe/0c0a07741b814f27e2aff27de5b7ddd53cf641003f74bbaefc256bb6c70c/django-mermaid-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-02 16:54:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pysnippet",
    "github_project": "django-mermaid",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-mermaid"
}
        
Elapsed time: 0.09869s