HTML escape a string of code.
(text: str)
| 153 | |
| 154 | |
| 155 | def code_escape(text: str) -> str: |
| 156 | """HTML escape a string of code.""" |
| 157 | if "&" in text: |
| 158 | text = text.replace("&", "&") |
| 159 | if "<" in text: |
| 160 | text = text.replace("<", "<") |
| 161 | if ">" in text: |
| 162 | text = text.replace(">", ">") |
| 163 | return text |
| 164 | |
| 165 | |
| 166 | def _get_stack_depth(size: int = 2) -> int: |