Skip to main content

A library to extract sections from Markdown files based on headers.

Project description

Markdown Extract

A Simple Python library to parse Markdown files from headers.

Installation

Clone the repository and install the package (or just use the markdown_extract folder).

Usage

from markdown_extract import MarkdownExtractor

markdown_content = """
# Section 1
Some content here.

## Subsection 1.1
More details.
"""

extractor = MarkdownExtractor(markdown_content)

# Get all content under "Section 1" (including subsections)
section_1 = extractor.get_section("Section 1")
print(section_1)

# Get content specifically under "Subsection 1.1"
subsection = extractor.get_section("Section 1", "Subsection 1.1")
print(subsection)

# You can also use bracket syntax to access sections
# This returns a Section object, which can be converted to string
section_1_bracket = extractor["Section 1"]
print(section_1_bracket)

# Chain brackets to access nested sections
subsection_bracket = extractor["Section 1"]["Subsection 1.1"]
print(subsection_bracket)

Features

  • Parses nested Markdown headers.
  • Retrieves raw content for any specific section hierarchy.
  • Preserves structure when retrieving higher-level sections.

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

markdown_extract-0.1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

markdown_extract-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file markdown_extract-0.1.0.tar.gz.

File metadata

  • Download URL: markdown_extract-0.1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for markdown_extract-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1c6b7f1bc54d244b9889c34e0d5ca5d2e3388d76c76508f6873d204ca9c16d56
MD5 180b1aad4035e98a7ed49563a38bda2b
BLAKE2b-256 07df35a47959cd4eafc409ad40b69cbdaf5dd247f650d5872dcace263700bbbe

See more details on using hashes here.

File details

Details for the file markdown_extract-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for markdown_extract-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ffa567689bddde2594edba96200e03d4ce686fd34a7689029e18371d64a43c3
MD5 347919e63ac3e9588c20c6c05ab572f8
BLAKE2b-256 5f1d729b2ed0cba247b6e7620d58de765e24b4568c5d7a6e325c1f7c5ce67cb8

See more details on using hashes here.

Supported by

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