Skip to main content

A simple Django template tag to automate escaping HTML for use with the iframe srcdoc attribute.

Project description

django-srcdoc

PyPI - Version PyPI - Python Version


Table of Contents

Installation

  1. Install django-srcdoc from PyPI:

    pip install django-srcdoc
    
  2. Add django-srcdoc to INSTALLED_APPS in your settings.py:

    INSTALLED_APPS = [
       # ...
       'django_srcdoc',
       # ...
    ]
    

Usage

After installation, use the {% srcdoc %} tag much like the {% filter %} tag. A brief example:

<iframe srcdoc="{% srcdoc %}{{ some_html_from_your_project }}{% endsrcdoc %}"></iframe>

HTML to be escaped could be written by hand, passed in as a variable, or added with an {% include %} tag (or any other method you like).

The tag will escape HTML per the iframe specification.

License

django-srcdoc is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_srcdoc-1.0.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_srcdoc-1.0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file django_srcdoc-1.0.1.tar.gz.

File metadata

  • Download URL: django_srcdoc-1.0.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.2

File hashes

Hashes for django_srcdoc-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6f7571348f4052f41f935c5ca0ea287a694233dcefca8e19e6931f07da58bda1
MD5 9b63c13a7ac9be0ae3ac2ed2cc9224d4
BLAKE2b-256 45066d46f3334d9c42faebb9c12d949ec0bf5ad5d0c49ea51016f3d0936ba426

See more details on using hashes here.

File details

Details for the file django_srcdoc-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_srcdoc-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc1634b5d46dd9af9721a2a3767f7a885705f2d6084303589cc1307f05ea5318
MD5 1f0730def15702e504035a7f7725ae72
BLAKE2b-256 bc352bcc424cdf7b51e0422544f5740f4a137b83ec7c7391995fd7976a7b40db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page