From a2f82678f762061527473692b6a0ac7287152959 Mon Sep 17 00:00:00 2001 From: G <17325189+GeeCastro@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:10:08 +0000 Subject: [PATCH] Add no css example to readme (#111) * Add no css example --------- Co-authored-by: G <17325189+Chichilele@users.noreply.github.com> --- README.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.rst b/README.rst index 06f319b..21a5972 100644 --- a/README.rst +++ b/README.rst @@ -173,6 +173,22 @@ change: def md(html, **options): return ImageBlockConverter(**options).convert(html) +.. code:: python + + from markdownify import MarkdownConverter + + class NoCssConverter(MarkdownConverter): + """ + Create a custom MarkdownConverter that removes the CSS code by ignoring the `style` tag + """ + def convert_style(self, el, text, convert_as_inline): + return '' + + # Create shorthand method for conversion + def md(html, **options): + return NoCssConverter(**options).convert(html) + + Command Line Interface ======================