Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yaml-to-markdown-0.1.1712543251.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file yaml-to-markdown-0.1.1712543251.tar.gz.

File metadata

File hashes

Hashes for yaml-to-markdown-0.1.1712543251.tar.gz
Algorithm Hash digest
SHA256 a42c6d458d587962e69db6231a64df17499515e1568e14cc10696bcd6c11859e
MD5 1f6c20e2ebc96b760e5371497961239d
BLAKE2b-256 f07ecfec1934ea8b63ccadd8ca439735b1209e6e53698d8013e4f5d06ff46c5a

See more details on using hashes here.

File details

Details for the file yaml_to_markdown-0.1.1712543251-py3-none-any.whl.

File metadata

File hashes

Hashes for yaml_to_markdown-0.1.1712543251-py3-none-any.whl
Algorithm Hash digest
SHA256 cf28cf4c48a58a8e25bd5a7e6be759e4d921c1c2f3c55a34b7e1862edd2519c1
MD5 b2bf3e072f34849465dcf1c73824da12
BLAKE2b-256 f5cd7281dfb37c87332194b76d74c1b5ce9ecfc010684e4042c0e4bd925b41a2

See more details on using hashes here.

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