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