How to use the mistune.directives.Admonition function in mistune

To help you get started, we’ve selected a few mistune 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 lepture / mistune / tests / test_directive.py View on Github external
def test_admonition_options(self):
        md = create_markdown(plugins=[Admonition()])
        s = '.. note:: Warnning\n\n   :option: 3'
        html = md(s)
        self.assertIn('Admonition has no options', html)
github lepture / mistune / tests / test_directive.py View on Github external
def test_code_admonition(self):
        md = create_markdown(plugins=[Admonition()])
        s = '.. note:: Warnning\n\n       print() '
        html = md(s)
        self.assertIn('class="admonition note"', html)
        self.assertIn('<h1>Warnning</h1>', html)
        self.assertIn('<pre><code>print()\n</code></pre>', html)
github lepture / mistune / tests / test_directive.py View on Github external
def test_note_admonition(self):
        md = create_markdown(plugins=[Admonition()])
        s = '.. note:: Warnning\n\n   message'
        html = md(s)
        self.assertIn('class="admonition note"', html)
        self.assertIn('<h1>Warnning</h1>', html)
        self.assertIn('<p>message</p>', html)
github lepture / mistune / tests / test_directive.py View on Github external
def test_note_admonition_no_text(self):
        md = create_markdown(
            plugins=[Admonition()]
        )
        s = '.. note:: Warnning'
        html = md(s)
        self.assertIn('class="admonition note"', html)
        self.assertIn('<h1>Warnning</h1>', html)
github lepture / mistune / tests / test_directive.py View on Github external
def test_unsupported_directive(self):
        md = create_markdown(plugins=[Admonition()])
        s = '.. hello:: Warnning\n\n   message'
        html = md(s)
        self.assertIn('Unsupported directive: hello', html)
github lepture / mistune / tests / test_directive.py View on Github external
def test_ast_admonition(self):
        data = fixtures.load_json('admonition.json')
        md = create_markdown(
            renderer='ast',
            plugins=[Admonition()]
        )
        # Use JSON to fix the differences between tuple and list
        tokens = json.loads(json.dumps(md(data['text'])))
        self.assertEqual(tokens, data['tokens'])