A simple markdown parsing package.
Project description
Markdown Worker
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
Release history Release notifications | RSS feed
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 details)
Built Distribution
File details
Details for the file markdown_worker-0.0.3.tar.gz
.
File metadata
- Download URL: markdown_worker-0.0.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40f0d52879cdaf7ef795f88c448e7599d8b5d02e0eee0d1facee73396c83170f |
|
MD5 | 85fc4c70c3fea9a5e428900e79f85491 |
|
BLAKE2b-256 | ec1dbc223752e23906d084bfd40c79660138cdd7de8e6b0ffd1704c186e8bfb9 |
File details
Details for the file markdown_worker-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: markdown_worker-0.0.3-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ad0179c08ad20ef51b7cafa31d6a79692c3a976d7642112beb372d55adff6f0 |
|
MD5 | 92dce9cb6e8f5bb84195995b442a43a0 |
|
BLAKE2b-256 | 94d58122d187716482bf113b6fad29c39d28371e601d2bdf53541d79d881ca13 |