Converts a YAML/JSON file or python Dict/List to a Markdown file
Project description
YAML to Markdown Converter
A Python utility to take a JSON / YAML file or a python dict / list and create a Markdown file.
Installation
pip install yaml-to-markdown
Usage
$ yaml-to-markdown --help
Convert JSON or YAML to Markdown.
Usage: yaml-to-markdown -o <output_file> [-y <yaml_file> | -j <json_file>]
-o, --output-file <output_file>: Path to the output file as a string [Mandatory].
-y, --yaml-file <yaml_file>: Path to the YAML file as a string [Optional]
-j, --json-file <json_file>: Path to the JSON file as a string [Optional]
-h, --help: Show this message and exit.
Note: Either yaml_file or json_file is required along with output_file.
Example: yaml-to-markdown -o output.md -y data.yaml
In Python Code example:
Convert a Pyton dictionary to Markdown:
from yaml_to_markdown.md_converter import MDConverter
data = {
"name": "John Doe",
"age": 30,
"city": "Sydney",
"hobbies": ["reading", "swimming"],
}
converter = MDConverter()
with open("output.md", "w") as f:
converter.convert(data, f)
Content of output.md
file will be:
## Name
John Doe
## Age
30
## City
Sydney
## Hobbies
* reading
* swimming
From the Command Line
You can also use the command line interface to convert a JSON or YAML file to Markdown. Here's an example:
Convert a JSON file to Markdown:
yaml-to-markdown --output-file output.md --json-file test.json
Convert a YAML file to Markdown:
yaml-to-markdown --output-file output.md --yaml-file test.yaml
Developer Guide
Please see the DEVELOPER.md file for more information on how to contribute to this project.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Built Distribution
Close
Hashes for yaml-to-markdown-0.1.1712531157.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10d97b5bb6b3d0aeb05495c659a58a1b3340abf399c3b3fe02cc4e6f70e52b34 |
|
MD5 | d52af41e8e10ef4a94ad04d53597bb1e |
|
BLAKE2b-256 | 2fa056b88e06e44f535ae0f1127d8280b151950119fa22e847e38659a9f2b58c |
Close
Hashes for yaml_to_markdown-0.1.1712531157-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85d0928d87609a107b1c5432cd07db42340d0d2e883f9d1187494569a46a3ac7 |
|
MD5 | a9262519459733cae3633e05b6b7bc98 |
|
BLAKE2b-256 | 319cc34a2ec2a67c1ec17f3b831b7de37cc9689185def2bc8a6deefeb73d3635 |