Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain that tag conversion functions are picked up automatically #116

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Creating Custom Converters

If you have a special usecase that calls for a special conversion, you can
always inherit from ``MarkdownConverter`` and override the method you want to
change:
change or add a function with the following pattern: `def convert_<TAG NAME>(self, el, text, convert_as_inline):`. The class will automatically run the corresponding tag content/element through it at conversion time.

.. code:: python

Expand All @@ -173,21 +173,6 @@ 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
Expand Down
Loading