Skip to content

chigwell/mdextractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI version License: MIT Downloads

mdextractor

mdextractor is a Python package designed for extracting code blocks from Markdown text. It efficiently identifies blocks enclosed in triple backticks (```), optionally preceded by language identifiers, and extracts their contents.

Installation

To install mdextractor, use pip:

pip install mdextractor

Usage

Using mdextractor is straightforward. Here's an example:

from mdextractor import extract_md_blocks

text = """
\`\`\`python
print("Hello, Markdown!")
\`\`\`
"""

blocks = extract_md_blocks(text)
print(blocks)
# Output: ['print("Hello, Markdown!")']

This package is useful in various applications where extracting code or preformatted text from Markdown is necessary.

Features

  • Efficient extraction of Markdown code blocks.
  • Supports language specifiers following the opening backticks.
  • Works with multi-line and single-line code blocks.
  • Simple API with a single function call.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

License

mdextractor is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages