ignore script and style content (such as css and javascript) (#112)

This commit is contained in:
Thomas L. Kjeldsen
2024-03-11 21:07:24 +01:00
committed by GitHub
parent c7718b6d81
commit 60967c1c95
2 changed files with 14 additions and 0 deletions

View File

@@ -350,6 +350,12 @@ class MarkdownConverter(object):
return '\n```%s\n%s\n```\n' % (code_language, text)
def convert_script(self, el, text, convert_as_inline):
return ''
def convert_style(self, el, text, convert_as_inline):
return ''
convert_s = convert_del
convert_strong = convert_b

View File

@@ -198,6 +198,14 @@ def test_pre():
assert md('<pre><span>\t\tthis should\t\tnot normalize</span></pre>') == '\n```\n\t\tthis should\t\tnot normalize\n```\n'
def test_script():
assert md('foo <script>var foo=42;</script> bar') == 'foo bar'
def test_style():
assert md('foo <style>h1 { font-size: larger }</style> bar') == 'foo bar'
def test_s():
inline_tests('s', '~~')