@@ -15,10 +15,10 @@ That said, if you fully trust the source of your input, you may choose to do
1515nothing. Conversely, you may find solutions other than those suggested here.
1616However, you do so at your own risk.
1717
18- ## Using JustHTML
18+ ## Using ` JustHTML `
1919
20- [ JustHTML] is recommended as a sanitizer on the output of ` markdown.markdown `
21- or ` Markdown.convert ` . When you pass HTML output through JustHTML, it is
20+ [ ` JustHTML ` ] [ JustHTML ] is recommended as a sanitizer on the output of ` markdown.markdown `
21+ or ` Markdown.convert ` . When you pass HTML output through ` JustHTML ` , it is
2222sanitized by default according to a strict [ allow list policy] . The policy
2323can be [ customized] if necessary.
2424
@@ -30,14 +30,14 @@ html = markdown.markdown(text)
3030safe_html = JustHTML(html, fragment = True ).to_html()
3131```
3232
33- ## Using nh3 or bleach
33+ ## Using ` nh3 ` or ` bleach `
3434
35- If you cannot use JustHTML for some reason, some alternatives include [ nh3] or
36- [ bleach] [ ^1 ] . However, be aware that these libraries will not be sufficient
35+ If you cannot use ` JustHTML ` for some reason, some alternatives include [ ` nh3 ` ] [ nh3 ] or
36+ [ ` bleach ` ] [ bleach ] [ ^ 1 ] . However, be aware that these libraries will not be sufficient
3737in themselves and will require customization. Some useful lists of allowed
3838tags and attributes can be found in the [ ` bleach-allowlist ` ]
39- [ bleach-allowlist] library, which should work with both nh3 and bleach as nh3
40- mirrors bleach's API.
39+ [ bleach-allowlist] library, which should work with both ` nh3 ` and ` bleach ` as ` nh3 `
40+ mirrors ` bleach ` 's API.
4141
4242``` python
4343import markdown
@@ -48,20 +48,20 @@ html = markdown.markdown(text)
4848safe_html = bleach.clean(html, markdown_tags, markdown_attrs)
4949```
5050
51- [ ^ 1 ] : The [ bleach] project has been [ deprecated] ( https://github.com/mozilla/bleach/issues/698 ) .
52- However, it may be the only option for some users as [ nh3] is a set of Python bindings to a Rust library.
51+ [ ^ 1 ] : The [ ` bleach ` ] [ bleach ] project has been [ deprecated] ( https://github.com/mozilla/bleach/issues/698 ) .
52+ However, it may be the only option for some users as ` nh3 ` is a set of Python bindings to a Rust library.
5353
5454## Sanitizing on the Command Line
5555
56- Both Python-Markdown and JustHTML provide command line interfaces which read
57- from STDIN and write to STDOUT. Therefore, they can be used together to
56+ Both Python-Markdown and ` JustHTML ` provide command line interfaces which read
57+ from ` STDIN ` and write to ` STDOUT ` . Therefore, they can be used together to
5858ensure that the output from untrusted input is properly sanitized.
5959
6060``` sh
6161echo " Some **Markdown** text." | python -m markdown | justhtml - --fragment > safe_output.html
6262```
6363
64- For more information on JustHTML's Command Line Interface, see the
64+ For more information on ` JustHTML ` 's Command Line Interface, see the
6565[ documentation] [ JustHTML_CLI ] . Use the ` --help ` option for a list of all available
6666options and arguments to the ` markdown ` command.
6767
0 commit comments