# Markdown Worker
[](https://badge.fury.io/py/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:
```bash
pip install markdown-worker
```
or
```bash
pip3 install markdown-worker
```
Alternatively, you can clone the GitHub repository:
```bash
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
```python
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
```python
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
```python
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
- [Mantresh Khurana](https://github.com/mantreshkhurana)
Raw data
{
"_id": null,
"home_page": null,
"name": "markdown-worker",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, mantresh khurana, parser, markdown",
"author": "Mantresh Khurana",
"author_email": "<mantreshkhurana@spyxpo.com>",
"download_url": "https://files.pythonhosted.org/packages/17/8a/b7aaa36f085342801d9ca4b8a1678e29b2728b9f0b9f501f74998fb5ea99/markdown_worker-0.0.4.tar.gz",
"platform": null,
"description": "\n# Markdown Worker\n\n[](https://badge.fury.io/py/markdown-worker)\n\nMarkdown 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.\n\n## Installation\n\nYou can install Markdown Worker via pip:\n\n```bash\npip install markdown-worker\n```\n\nor\n\n```bash\npip3 install markdown-worker\n```\n\nAlternatively, you can clone the GitHub repository:\n\n```bash\ngit clone https://github.com/mantreshkhurana/markdown-worker-python.git\ncd markdown-worker-python\n```\n\n## Features\n\n- Read and parse Markdown files.\n- Search for specific headers within a Markdown file.\n- Retrieve content associated with a particular header.\n- Convert Markdown to HTML.\n- Simple and intuitive API.\n\n## Usage\n\n### Reading and Parsing Markdown Files\n\n```python\nfrom markdown_worker import MarkdownParser\n\n# Initialize the parser with a Markdown file\nparser = MarkdownParser(\"example.md\")\n\n# Read the entire file\nmarkdown_content = parser.read_complete_file()\n\n# Extract headers and paragraphs\nheaders, paragraphs, _ = parser.extract_headers_and_paragraphs()\n\n# Print the extracted headers\nprint(\"Headers:\", headers)\n\n# Print the extracted paragraphs\nprint(\"Paragraphs:\", paragraphs)\n```\n\n### Searching for a Header\n\n```python\nfrom markdown_worker import MarkdownParser\n\n# Initialize the parser with a Markdown file\nparser = MarkdownParser(\"example.md\")\n\n# Search for a specific header\nheading_to_search = \"Usage\"\nresult = parser.search_heading(heading_to_search)\n\n# Print the content under the searched header\nprint(\"Content under the heading:\", result)\n```\n\n### Convert Markdown to HTML\n\n```python\nfrom markdown_worker import MarkdownParser\n\n# Initialize the parser with a Markdown file\nparser = MarkdownParser(\"example.md\")\n\n# Read the entire file\nmarkdown_content = parser.read_complete_file()\n\n# Convert Markdown to HTML\nhtml_content = parser.markdown_to_html(markdown_content)\n\n# Print the HTML content\nprint(\"HTML Content:\", html_content)\n```\n\n## Example\n\nAn example Markdown file (`example.md`) is provided in the repository, containing documentation for the program.\n\n## Author\n\n- [Mantresh Khurana](https://github.com/mantreshkhurana)\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple markdown parsing package.",
"version": "0.0.4",
"project_urls": null,
"split_keywords": [
"python",
" mantresh khurana",
" parser",
" markdown"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "ed8823c39eda9dbb65f7891f0db7d5e73061afda6d1b4448d4b315ef19961c60",
"md5": "06be9fed704fcf7a9bff741aad4a6d58",
"sha256": "1c1bda458d3813cc3789329ae72f7fc45cd4d44313c87a985d3e40f7703289a3"
},
"downloads": -1,
"filename": "markdown_worker-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "06be9fed704fcf7a9bff741aad4a6d58",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4707,
"upload_time": "2025-02-07T14:01:40",
"upload_time_iso_8601": "2025-02-07T14:01:40.754219Z",
"url": "https://files.pythonhosted.org/packages/ed/88/23c39eda9dbb65f7891f0db7d5e73061afda6d1b4448d4b315ef19961c60/markdown_worker-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "178ab7aaa36f085342801d9ca4b8a1678e29b2728b9f0b9f501f74998fb5ea99",
"md5": "47cbc926480d02d08a05ae0a53320b86",
"sha256": "1b53a82f0c6d68b021c1818a942175ed79794d25c80a265bfa8400f1ca3218d0"
},
"downloads": -1,
"filename": "markdown_worker-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "47cbc926480d02d08a05ae0a53320b86",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4297,
"upload_time": "2025-02-07T14:01:41",
"upload_time_iso_8601": "2025-02-07T14:01:41.916587Z",
"url": "https://files.pythonhosted.org/packages/17/8a/b7aaa36f085342801d9ca4b8a1678e29b2728b9f0b9f501f74998fb5ea99/markdown_worker-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-07 14:01:41",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "markdown-worker"
}