ignore script and style content (such as css and javascript) (#112)
This commit is contained in:
committed by
GitHub
parent
c7718b6d81
commit
60967c1c95
@@ -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
|
||||
|
||||
@@ -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', '~~')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user