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.0.tar.gz (6.5 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.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for django_srcdoc-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8176d1b10cdb30582b4373e2894449304dc7b385a8c211fe63806675ee11e498
MD5 2445b98e04688ac3cfa2a1a79d08fe91
BLAKE2b-256 4de3cacaca7b65e73b704e75ddc44009f4eeaa10a7ec8cb32f4adbe09044df74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_srcdoc-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b740836d2cf151d511693991c76f7c15947943d9597bb7572aa72e98c3cbfa4
MD5 a1d0f0e210ec82121ecf3f6d5b7deb15
BLAKE2b-256 0744d2d5dd43a089964358ef16269825db83913cef35ce3b52b09260848cd9d9

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