django-markdownify


Namedjango-markdownify JSON
Version 0.9.5 PyPI version JSON
download
home_pagehttps://github.com/erwinmatijsen/django-markdownify
SummaryMarkdown template filter for Django.
upload_time2024-05-09 11:45:27
maintainerNone
docs_urlNone
authorErwin Matijsen, R Moelker
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django Markdownify - A Django Markdown filter

![PyPi Downloads](https://img.shields.io/pypi/dm/django-markdownify) 
![License](https://img.shields.io/pypi/l/django-markdownify?color=brightgreen)
[![Documentation Status](https://readthedocs.org/projects/django-markdownify/badge/?version=latest)](https://django-markdownify.readthedocs.io/en/latest/?badge=latest)
![Version](https://img.shields.io/pypi/v/django-markdownify)

Django Markdownify is a template filter to convert Markdown to HTML in Django. Markdown is converted to HTML and sanitized.

Read the full documentation on [Read the docs](http://django-markdownify.readthedocs.io/en/latest/) or check out the package on [pypi](https://pypi.python.org/pypi/django-markdownify).

> [!WARNING]  
> The [old settings](https://django-markdownify.readthedocs.io/en/latest/settings-old.html#oldsettings) are removed in release 0.9.4! Please update to the [new settings](https://django-markdownify.readthedocs.io/en/latest/settings.html) as soon as possible.

## Usage

Load the tag inside your template:

```
{% load markdownify %}
```

Then you can change markdown to html as follows:

```
{{ 'text'|markdownify }}
```

or

```
{{ somevariable|markdownify }}
```

## Example

```
{% load markdownify %}
{{'Some *test* [link](#)'|markdownify }}
```

Is transformed to:

```html
<p>
  Some <em>test</em> <a href="#">link</a>
</p>
```

The filter is a wrapper around [Markdown](https://pypi.python.org/pypi/Markdown) and
[Bleach](http://pythonhosted.org/bleach/index.html) and as such supports their settings. 
It is possible to define multiple settings for multiple usecases.

For example:

```python
# settings.py

MARKDOWNIFY = {
  "default": {
     "WHITELIST_TAGS": ["a", "p", "h1", ]
  },

  "alternative": {
     "WHITELIST_TAGS": ["a", "p", ],
     "MARKDOWN_EXTENSIONS": ["markdown.extensions.fenced_code", ]
  }
}
```

And in your templates:

```html

<!-- page1.html -->
{{ mytext|markdownify }} <!-- Uses your default settings -->

<!-- page2.html -->
{{ mytext|markdownify:"alternative" }} <!-- Uses your alternative settings -->
```

## Documentation
Read the full documentation on [Read the docs](https://django-markdownify.readthedocs.io/en/latest/).

## Credits
This filter is a slightly richer and packaged version of the snippet: [using-markdown-django-17](http://www.jw.pe/blog/post/using-markdown-django-17/).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/erwinmatijsen/django-markdownify",
    "name": "django-markdownify",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Erwin Matijsen, R Moelker",
    "author_email": "erwin@erwinmatijsen.nl",
    "download_url": "https://files.pythonhosted.org/packages/6c/33/3abb966e2b238af4c9a5d3ee38a7aa7e51b644b4b20bf8533b6fd1c1bf96/django_markdownify-0.9.5.tar.gz",
    "platform": null,
    "description": "# Django Markdownify - A Django Markdown filter\n\n![PyPi Downloads](https://img.shields.io/pypi/dm/django-markdownify) \n![License](https://img.shields.io/pypi/l/django-markdownify?color=brightgreen)\n[![Documentation Status](https://readthedocs.org/projects/django-markdownify/badge/?version=latest)](https://django-markdownify.readthedocs.io/en/latest/?badge=latest)\n![Version](https://img.shields.io/pypi/v/django-markdownify)\n\nDjango Markdownify is a template filter to convert Markdown to HTML in Django. Markdown is converted to HTML and sanitized.\n\nRead the full documentation on [Read the docs](http://django-markdownify.readthedocs.io/en/latest/) or check out the package on [pypi](https://pypi.python.org/pypi/django-markdownify).\n\n> [!WARNING]  \n> The [old settings](https://django-markdownify.readthedocs.io/en/latest/settings-old.html#oldsettings) are removed in release 0.9.4! Please update to the [new settings](https://django-markdownify.readthedocs.io/en/latest/settings.html) as soon as possible.\n\n## Usage\n\nLoad the tag inside your template:\n\n```\n{% load markdownify %}\n```\n\nThen you can change markdown to html as follows:\n\n```\n{{ 'text'|markdownify }}\n```\n\nor\n\n```\n{{ somevariable|markdownify }}\n```\n\n## Example\n\n```\n{% load markdownify %}\n{{'Some *test* [link](#)'|markdownify }}\n```\n\nIs transformed to:\n\n```html\n<p>\n  Some <em>test</em> <a href=\"#\">link</a>\n</p>\n```\n\nThe filter is a wrapper around [Markdown](https://pypi.python.org/pypi/Markdown) and\n[Bleach](http://pythonhosted.org/bleach/index.html) and as such supports their settings. \nIt is possible to define multiple settings for multiple usecases.\n\nFor example:\n\n```python\n# settings.py\n\nMARKDOWNIFY = {\n  \"default\": {\n     \"WHITELIST_TAGS\": [\"a\", \"p\", \"h1\", ]\n  },\n\n  \"alternative\": {\n     \"WHITELIST_TAGS\": [\"a\", \"p\", ],\n     \"MARKDOWN_EXTENSIONS\": [\"markdown.extensions.fenced_code\", ]\n  }\n}\n```\n\nAnd in your templates:\n\n```html\n\n<!-- page1.html -->\n{{ mytext|markdownify }} <!-- Uses your default settings -->\n\n<!-- page2.html -->\n{{ mytext|markdownify:\"alternative\" }} <!-- Uses your alternative settings -->\n```\n\n## Documentation\nRead the full documentation on [Read the docs](https://django-markdownify.readthedocs.io/en/latest/).\n\n## Credits\nThis filter is a slightly richer and packaged version of the snippet: [using-markdown-django-17](http://www.jw.pe/blog/post/using-markdown-django-17/).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Markdown template filter for Django.",
    "version": "0.9.5",
    "project_urls": {
        "Download": "https://github.com/erwinmatijsen/django-markdownify/archive/0.9.5.tar.gz",
        "Homepage": "https://github.com/erwinmatijsen/django-markdownify"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b35c7a4bd957b279a8e7c808116bed399b73874ed3da78689993ee76f30d9f6",
                "md5": "175ea19a37702cc3411b93517b18b1e8",
                "sha256": "2c4ae44e386c209453caf5e9ea1b74f64535985d338ad2d5ad5e7089cc94be86"
            },
            "downloads": -1,
            "filename": "django_markdownify-0.9.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "175ea19a37702cc3411b93517b18b1e8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10342,
            "upload_time": "2024-05-09T11:45:25",
            "upload_time_iso_8601": "2024-05-09T11:45:25.895823Z",
            "url": "https://files.pythonhosted.org/packages/1b/35/c7a4bd957b279a8e7c808116bed399b73874ed3da78689993ee76f30d9f6/django_markdownify-0.9.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c333abb966e2b238af4c9a5d3ee38a7aa7e51b644b4b20bf8533b6fd1c1bf96",
                "md5": "a7e23a24b4366d54cec62bbc4fe7ee82",
                "sha256": "34c34eba4a797282a5c5bd97b13cec84d6a4c0673ad47ce1c1d000d74dd8d4ab"
            },
            "downloads": -1,
            "filename": "django_markdownify-0.9.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a7e23a24b4366d54cec62bbc4fe7ee82",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7939,
            "upload_time": "2024-05-09T11:45:27",
            "upload_time_iso_8601": "2024-05-09T11:45:27.661170Z",
            "url": "https://files.pythonhosted.org/packages/6c/33/3abb966e2b238af4c9a5d3ee38a7aa7e51b644b4b20bf8533b6fd1c1bf96/django_markdownify-0.9.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-09 11:45:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "erwinmatijsen",
    "github_project": "django-markdownify",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-markdownify"
}
        
Elapsed time: 0.29415s