Debian Codegraph @

docs/src/markdown/extensions/escapeall.md

raw
1 ---
2 icon: lucide/locate-off
3 ---
4 [:octicons-file-code-24:][_escapeall]{: .source-link }
5
6 # EscapeAll
7
8 ## Overview
9
10 If you ever have to stop and try to remember, *Can I escape this char?* or *Will a backslash escape this?*, you are not
11 alone. EscapeAll makes `\` escape everything making such questions moot. Now instead of questioning or looking up what
12 can be escaped, you can expect that `\` will escape the character following it. So if you need a literal `\`, just
13 escape it: `\\`. Keep in mind this will not escape things in code blocks of any kind.
14
15 ```text title="Escaping"
16 \W\e\ \c\a\n\ \e\s\c\a\p\e
17 \e\v\e\r\y\t\h\i\n\g\!\ \
18 \❤\😄
19 ```
20
21 /// html | div.result
22 \W\e\ \c\a\n\ \e\s\c\a\p\e
23 \e\v\e\r\y\t\h\i\n\g\!\ \
24 \❤\😄
25 ///
26
27 There are two special escapes among all of these escapes though: escaping "space" characters and escaping "newline"
28 characters. If `nbsp` is enabled, an escaped space will be converted into a non-breaking space: `#!html  `. If
29 `hardbreak` is enabled, an escaped newline will be converted to a hard break `#!html <br>`. The advantage of `hardbreak`
30 is that you can visually see the hard break opposed to Markdown's default method of two spaces at the end of a line.
31
32 So in short, EscapeAll escapes all inline characters.
33
34 /// question | Q & A
35 **So all ASCII characters?**
36
37 _It escapes everything._
38
39 **What about Unicode?**
40
41 _It escapes everything!_
42
43 **What about...**
44
45 _EVERYTHING! IT ESCAPES EVERYTHING!_
46 ///
47
48 The EscapeAll extension can be included in Python Markdown by using the following:
49
50 ```py3
51 import markdown
52 md = markdown.Markdown(extensions=['pymdownx.escapeall'])
53 ```
54
55 ## Options
56
57 Option | Type | Default | Description
58 ----------- | ---- | --------------- | ----------
59 `hardbreak` | bool | `#!py3 False` | Escaped newlines will be hard breaks: `#!html <br>`.
60 `nbsp` | bool | `#!py3 False` | Escaped spaces will be non-breaking spaces: `#!html &nbsp;`.