From 60967c1c9563405a06ebae2735a049e37258b689 Mon Sep 17 00:00:00 2001 From: "Thomas L. Kjeldsen" Date: Mon, 11 Mar 2024 21:07:24 +0100 Subject: [PATCH] ignore script and style content (such as css and javascript) (#112) --- markdownify/__init__.py | 6 ++++++ tests/test_conversions.py | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/markdownify/__init__.py b/markdownify/__init__.py index bf765ec..151a222 100644 --- a/markdownify/__init__.py +++ b/markdownify/__init__.py @@ -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 diff --git a/tests/test_conversions.py b/tests/test_conversions.py index 1ecaf3c..5c6ec06 100644 --- a/tests/test_conversions.py +++ b/tests/test_conversions.py @@ -198,6 +198,14 @@ def test_pre(): assert md('
\t\tthis  should\t\tnot  normalize
') == '\n```\n\t\tthis should\t\tnot normalize\n```\n' +def test_script(): + assert md('foo bar') == 'foo bar' + + +def test_style(): + assert md('foo bar') == 'foo bar' + + def test_s(): inline_tests('s', '~~')