Skip to main content

A simple markdown parsing package.

Project description

Markdown Worker

PyPI version

Markdown Worker is a versatile Python module for parsing, reading, and writing Markdown files. It simplifies the process of working with Markdown documents by providing a convenient interface for common tasks.

Installation

You can install Markdown Worker via pip:

pip install markdown-worker

or

pip3 install markdown-worker

Alternatively, you can clone the GitHub repository:

git clone https://github.com/mantreshkhurana/markdown-worker-python.git
cd markdown-worker-python

Features

  • Read and parse Markdown files.
  • Search for specific headers within a Markdown file.
  • Retrieve content associated with a particular header.
  • Convert Markdown to HTML.
  • Simple and intuitive API.

Usage

Reading and Parsing Markdown Files

from markdown_worker import MarkdownParser

# Initialize the parser with a Markdown file
parser = MarkdownParser("example.md")

# Read the entire file
markdown_content = parser.read_complete_file()

# Extract headers and paragraphs
headers, paragraphs, _ = parser.extract_headers_and_paragraphs()

# Print the extracted headers
print("Headers:", headers)

# Print the extracted paragraphs
print("Paragraphs:", paragraphs)

Searching for a Header

from markdown_worker import MarkdownParser

# Initialize the parser with a Markdown file
parser = MarkdownParser("example.md")

# Search for a specific header
heading_to_search = "Usage"
result = parser.search_heading(heading_to_search)

# Print the content under the searched header
print("Content under the heading:", result)

Convert Markdown to HTML

from markdown_worker import MarkdownParser

# Initialize the parser with a Markdown file
parser = MarkdownParser("example.md")

# Read the entire file
markdown_content = parser.read_complete_file()

# Convert Markdown to HTML
html_content = parser.markdown_to_html(markdown_content)

# Print the HTML content
print("HTML Content:", html_content)

Example

An example Markdown file (example.md) is provided in the repository, containing documentation for the program.

Author

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_worker-0.0.3.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

markdown_worker-0.0.3-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

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