Skip to content

Commit a2f8267

Browse files
authored
Add no css example to readme (#111)
* Add no css example --------- Co-authored-by: G <17325189+Chichilele@users.noreply.github.com>
1 parent 60967c1 commit a2f8267

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,22 @@ change:
173173
def md(html, **options):
174174
return ImageBlockConverter(**options).convert(html)
175175
176+
.. code:: python
177+
178+
from markdownify import MarkdownConverter
179+
180+
class NoCssConverter(MarkdownConverter):
181+
"""
182+
Create a custom MarkdownConverter that removes the CSS code by ignoring the `style` tag
183+
"""
184+
def convert_style(self, el, text, convert_as_inline):
185+
return ''
186+
187+
# Create shorthand method for conversion
188+
def md(html, **options):
189+
return NoCssConverter(**options).convert(html)
190+
191+
176192
177193
Command Line Interface
178194
======================

0 commit comments

Comments
 (0)