Skip to content

raimon49/mkdocs-safe-text-plugin

Repository files navigation

mkdocs-safe-text-plugin

Build Status PyPI - Python Version PyPI version GitHub Release Codecov BSD License

Plugin for safe text editing with MKDocs.

Table of Contents

How does this plugin work?

Markdown is a very flexible format, and raw HTML is allowed. But it is unnecessary in multiple-person text editing.

When raw HTML like <font> tag is used in MKDocs, it is rendered as it is.

No escaped font

If you use this plug-in with MKDocs, tags that are not allowed in the allowlist are escaped.

Escaped font

Installation

Install it via PyPI using pip command.

$ pip install mkdocs-safe-text-plugin

And add it to your mkdocs.yml file.

plugins:
  - mkdocs_safe_text

An example of use can be checked by example/basic-usage.

Plugin configuration

This plugin works with the HTML tag element for Markdown defined by bleach-allowlist enabled. This implementation approach is recommended in the Python-Markdown release notes.

And user can change this setting.

plugins:
  - mkdocs_safe_text:
      append_allowed_tags:
        - tag1
        - tag2
      remove_allowed_tags:
        - tag3
        - tag4
      allowed_attrs:
        tag5:
          - attribute1
          - attribute2

An example of use can be checked by example/customization-usage.

License

BSD 2-Clause License