mdfy - Transform text into beautiful markdownΒΆ
Transform text into beautiful markdown, effortlessly. mdfy provides a simple, intuitive API for creating markdown documents programmatically with Python.
β¨ Key FeaturesΒΆ
Just a few lines of code and voila! An intuitive architecture made simple.
Each module is highly independent, making it easy to use on its own.
Extensible design allowing for easy customization.
Robust unit tests ensure reliability.
π Quick StartΒΆ
InstallationΒΆ
pip install mdfy
Your First DocumentΒΆ
from mdfy import Mdfier, MdHeader, MdText, MdTable
contents = [
MdHeader("Hello, MDFY!"),
MdText("[Life:bold] is [like:italic] a bicycle."),
MdTable({"head1": "content", "head2": "content"})
]
Mdfier("markdown.md").write(contents)
This creates a markdown file with:
# Hello, MDFY!
**Life** is *like* a bicycle.
| head1 | head2 |
| --- | --- |
| content | content |
Note
New to mdfy? Check out our Getting Started guide for a step-by-step tutorial!
π‘ Advanced UsageΒΆ
Nested ContentΒΆ
You can pass nested lists to Mdfier.write and they will be flattened:
from mdfy import Mdfier, MdText, MdHeader
group = ["Group A", "Group B"]
group_agg_results = [
[2, 3, 0, 1],
[4, 2, 1, 0],
]
contents = [
MdHeader("Hello, MDFY!"),
[
(
MdHeader(group_name, level=2),
MdText(f"Sum: {sum(group_agg_result)} ({', '.join(map(str, group_agg_result))})")
)
for group_name, group_agg_result in zip(group, group_agg_results)
]
]
Mdfier("markdown.md").write(contents)
Independent ElementsΒΆ
Each mdfy element is string-convertible and can operate independently:
from mdfy import MdText, MdHeader, MdTable
print(MdHeader("Hello, MDFY!"))
print(MdText("[Life:bold] is [like:italic] a bicycle."))
print(MdTable({"head1": "content", "head2": "content"}))
π DocumentationΒΆ
Getting Started
User Guide
π οΈ DevelopmentΒΆ
Want to contribute? Great! Hereβs how to get started:
Fork the repository
Create a feature branch
Make your changes
Run tests:
python -m pytestSubmit a pull request
π LicenseΒΆ
This project is licensed under the MIT License. See the LICENSE file for details.
π LinksΒΆ
π¦ PyPI Package
π GitHub Repository
π Documentation
π Issue Tracker