Skip to content

Tilde

Overview

Tilde optionally adds two different features which are syntactically built around the ~ character: delete which inserts <del></del> tags and subscript which inserts <sub></sub> tags.

The Tilde extension can be included in Python Markdown by using the following:

import markdown
md = markdown.Markdown(extensions=['pymdownx.tilde'])

Delete

To wrap content in a delete tag, simply surround the text with double ~. You can also enable smart_delete in the options. Smart behavior of delete models that of BetterEm.

Delete
~~Delete me~~

Delete me

Subscript

To denote a subscript, you can surround the desired content in single ~. It uses Pandoc style logic, so if your subscript needs to have spaces, you must escape the spaces.

Subscript
CH~3~CH~2~OH

text~a\ subscript~

CH3CH2OH

texta subscript

Options

Option Type Default Description
smart_delete bool True Use smart logic with delete characters.
delete bool True Enable delete feature.
subscript bool True Enable subscript feature.