Skip to main content

Extract Markdown code blocks from text strings.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdextractor-0.0.3.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

mdextractor-0.0.3-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file mdextractor-0.0.3.tar.gz.

File metadata

  • Download URL: mdextractor-0.0.3.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.9

File hashes

Hashes for mdextractor-0.0.3.tar.gz
Algorithm Hash digest
SHA256 7310fa18267025480bac3a35239fab56eb91129c278bc481837212ac81cf897c
MD5 b200d55405b66a30453b901e3fab8cef
BLAKE2b-256 0bd9d45c68710cd078b46f5203a6a12a3c1a89b37e0112b5a15dcdaf9076df69

See more details on using hashes here.

File details

Details for the file mdextractor-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: mdextractor-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.9

File hashes

Hashes for mdextractor-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 230415829692e6d27da4311bf7bf2720c9f1f2ee277f930a230a34dd6431f3f6
MD5 6f1ba6b12620bad57e9c7e7a749c8790
BLAKE2b-256 6b978587f812d005165c8dfa1ecc16260deb8ad3caad189bc455561b7cf89dc9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page