| 1 |
--- |
| 2 |
icon: lucide/subscript |
| 3 |
--- |
| 4 |
[:octicons-file-code-24:][_tilde]{: .source-link } |
| 5 |
|
| 6 |
# Tilde |
| 7 |
|
| 8 |
## Overview |
| 9 |
|
| 10 |
Tilde optionally adds two different features which are syntactically built around the `~` character: **delete** which |
| 11 |
inserts `#!html <del></del>` tags and **subscript** which inserts `#!html <sub></sub>` tags. |
| 12 |
|
| 13 |
The Tilde extension can be included in Python Markdown by using the following: |
| 14 |
|
| 15 |
```py3 |
| 16 |
import markdown |
| 17 |
md = markdown.Markdown(extensions=['pymdownx.tilde']) |
| 18 |
``` |
| 19 |
|
| 20 |
## Delete |
| 21 |
|
| 22 |
To wrap content in a **delete** tag, simply surround the text with double `~`. You can also enable `smart_delete` in the |
| 23 |
[options](#options). Smart behavior of **delete** models that of [BetterEm](betterem.md#rules). |
| 24 |
|
| 25 |
```text title="Delete" |
| 26 |
~~Delete me~~ |
| 27 |
``` |
| 28 |
|
| 29 |
/// html | div.result |
| 30 |
~~Delete me~~ |
| 31 |
/// |
| 32 |
|
| 33 |
## Subscript |
| 34 |
|
| 35 |
To denote a subscript, you can surround the desired content in single `~`. It uses Pandoc style logic, so if your |
| 36 |
subscript needs to have spaces, you must escape the spaces. |
| 37 |
|
| 38 |
```text title="Subscript" |
| 39 |
CH~3~CH~2~OH |
| 40 |
|
| 41 |
text~a\ subscript~ |
| 42 |
``` |
| 43 |
|
| 44 |
/// html | div.result |
| 45 |
CH~3~CH~2~OH |
| 46 |
|
| 47 |
text~a\ subscript~ |
| 48 |
/// |
| 49 |
|
| 50 |
## Options |
| 51 |
|
| 52 |
Option | Type | Default | Description |
| 53 |
-------------- | ---- | ----------- | ----------- |
| 54 |
`smart_delete` | bool | `#!py3 True` | Use smart logic with delete characters. |
| 55 |
`delete` | bool | `#!py3 True` | Enable delete feature. |
| 56 |
`subscript` | bool | `#!py3 True` | Enable subscript feature. |