Commit 996bcdd332551b82791ab0851e2f7f826bc0a4ed
- Diff rendering mode:
- inline
- side by side
markdown/postprocessors.py
(8 / 0)
|   | |||
| 44 | 44 | """ Iterate over html stash and restore "safe" html. """ | |
| 45 | 45 | for i in range(self.markdown.htmlStash.html_counter): | |
| 46 | 46 | html, safe = self.markdown.htmlStash.rawHtmlBlocks[i] | |
| 47 | html = self.unescape(html) | ||
| 47 | 48 | if self.markdown.safeMode and not safe: | |
| 48 | 49 | if str(self.markdown.safeMode).lower() == 'escape': | |
| 49 | 50 | html = self.escape(html) | |
| … | … | ||
| 59 | 59 | text = text.replace(markdown.preprocessors.HTML_PLACEHOLDER % i, | |
| 60 | 60 | html) | |
| 61 | 61 | return text | |
| 62 | |||
| 63 | def unescape(self, html): | ||
| 64 | """ Unescape any markdown escaped text within inline html. """ | ||
| 65 | for k, v in self.markdown.treeprocessors['inline'].stashed_nodes.items(): | ||
| 66 | ph = markdown.INLINE_PLACEHOLDER % k | ||
| 67 | html = html.replace(ph, '\%s' % v) | ||
| 68 | return html | ||
| 62 | 69 | ||
| 63 | 70 | def escape(self, html): | |
| 64 | 71 | """ Basic html escaping """ |
tests/misc/html.html
(1 / 0)
|   | |||
| 11 | 11 | ||
| 12 | 12 | <p>And of course <script>blah</script>.</p> | |
| 13 | 13 | <p><a href="script>stuff</script">this <script>link</a></p> | |
| 14 | <p>Some funky <x\]> inline stuff with markdown escaping syntax.</p> |
tests/misc/html.txt
(2 / 0)
|   | |||
| 14 | 14 | And of course <script>blah</script>. | |
| 15 | 15 | ||
| 16 | 16 | [this <script>link](<script>stuff</script>) | |
| 17 | |||
| 18 | Some funky <x\]> inline stuff with markdown escaping syntax. |

