You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

markdown-tree-parser

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-tree-parser

Markdown tree parser

0.1
pipPyPI
Maintainers
1

markdown-tree-parser

Parse markdown file to python object, which contains markdown tree headings

Usage examples

import unittest

from markdown_tree_parser.parser import parse_string


class TestParser(unittest.TestCase):

    def test_code_block(self):
        text = '''
Title
=====

# Code

Code 1
------
Some text
\```
# TODO
\```

Code 2
------
\```python
# TODO
print('test')
\```

# Heading
'''
        out = parse_string(text)
        self.assertEqual(out.title, 'Title')
        self.assertEqual(out[0][0].text, 'Code 1')
        self.assertEqual(out[0][0].source, 'Some text\n```\n# TODO\n```\n')
        self.assertEqual(out[0][1].text, 'Code 2')
        self.assertEqual(out[0][1].source, "```python\n# TODO\nprint('test')\n```\n")
        self.assertEqual(out[1].text, 'Heading')


if __name__ == '__main__':
    unittest.main()

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts