How to use markdownify - 10 common examples

To help you get started, we’ve selected a few markdownify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matthewwithanm / python-markdownify / tests.py View on Github external
def test_a_with_title(self):
        self.assertEqual(
            md('<a title="The &quot;Goog&quot;" href="http://google.com">Google</a>'),
            r'[Google](http://google.com "The \"Goog\"")'
        )
github matthewwithanm / python-markdownify / tests / test_conversions.py View on Github external
def test_img():
    assert md('<img title="Optional title" alt="Alt text" src="/path/to/img.jpg">') == '![Alt text](/path/to/img.jpg "Optional title")'
    assert md('<img alt="Alt text" src="/path/to/img.jpg">') == '![Alt text](/path/to/img.jpg)'
github matthewwithanm / python-markdownify / tests.py View on Github external
def test_do_not_convert(self):
        self.assertEqual(
            md('<a href="https://github.com/matthewwithanm">Some Text</a>', convert=[]),
            'Some Text')
github matthewwithanm / python-markdownify / tests.py View on Github external
def test_whitespace(self):
        self.assertEqual(md(' a  b \n\n c '), ' a b c ')
github matthewwithanm / python-markdownify / tests / test_conversions.py View on Github external
def test_a_no_autolinks():
    text = md('<a href="http://google.com">http://google.com</a>', autolinks=False)
    assert text == '[http://google.com](http://google.com)'
github matthewwithanm / python-markdownify / tests / test_conversions.py View on Github external
def test_ol():
    assert md('<ol><li>a</li><li>b</li></ol>') == '1. a\n2. b\n'
github matthewwithanm / python-markdownify / tests.py View on Github external
def test_b(self):
        self.assertEqual(md('<b>Hello</b>'), '**Hello**')
github matthewwithanm / python-markdownify / tests / test_conversions.py View on Github external
def test_ul():
    assert md('<ul><li>a</li><li>b</li></ul>') == '* a\n* b\n'
github matthewwithanm / python-markdownify / tests.py View on Github external
def test_ol(self):
        self.assertEqual(md('<ol><li>a</li><li>b</li></ol>'), '1. a\n2. b\n')
github matthewwithanm / python-markdownify / tests / test_conversions.py View on Github external
def test_atx_headings():
    assert md('<h1>Hello</h1>', heading_style=ATX) == '# Hello\n\n'
    assert md('<h2>Hello</h2>', heading_style=ATX) == '## Hello\n\n'

markdownify

Convert HTML to markdown.

MIT
Latest version published 2 months ago

Package Health Score

86 / 100
Full package analysis

Similar packages