Skip to main content

datasette-render-html

PyPI Changelog Tests License

This Datasette plugin lets you configure Datasette to render specific columns as HTML in the table and row interfaces.

This means you can store HTML in those columns and have it rendered as such on those pages.

If you have a database called docs.db containing a glossary table and you want the definition column in that table to be rendered as HTML, you would use a metadata.json file that looks like this:

{
    "databases": {
        "docs": {
            "tables": {
                "glossary": {
                    "plugins": {
                        "datasette-render-html": {
                            "columns": ["definition"]
                        }
                    }
                }
            }
        }
    }
}

Installation

Install this plugin in the same environment as Datasette.

$ datasette install datasette-render-html

Usage

With the plugin installed, launch Datasette with the above metadata.json configuration:

$ datasette -m metadata.json docs.db

Security

This plugin allows HTML to be rendered exactly as it is stored in the database. As such, you should be sure only to use this against columns with content that you trust - otherwise you could open yourself up to an XSS attack.

It's possible to configure this plugin to apply to columns with specific names across whole databases or the full Datasette instance, but doing so is not safe. It could open you up to XSS vulnerabilities where an attacker composes a SQL query that results in a column containing unsafe HTML.

As such, you should only use this plugin against specific columns in specific tables, as shown in the example above.

Metadata

Release files for datasette-render-html 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datasette-render-html 1.0
File Size Uploaded
datasette-render-html-1.0.tar.gz 2.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for datasette-render-html 1.0
File Interpreter ABI Platform
datasette_render_html-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.1 kB

Release files / datasette-render-html-1.0.tar.gz

Download URL datasette-render-html-1.0.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8e7a9ab21caed72cf42ebef4cecb0e84a6d2068e4681b4eeddfc48c5379949ab
BLAKE2b-256 checksum
How to use checksums
763287bb45b4f790041575429fdf04681c6ef5a4104c4d710054c83a2b9391a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / datasette_render_html-1.0-py3-none-any.whl

Download URL datasette_render_html-1.0-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6437c015bfb25bef983451b3840fc81fe9c1636c3158064d6ce04dde0f850f2
BLAKE2b-256 checksum
How to use checksums
23fe2ff9b3952ddd442004a44c78beee8dd842dae2ac16e9a7baa98329ebeea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page