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.1744598339.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yaml_to_markdown-0.1.1744598339-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file yaml_to_markdown-0.1.1744598339.tar.gz.

File metadata

File hashes

Hashes for yaml_to_markdown-0.1.1744598339.tar.gz
Algorithm Hash digest
SHA256 2e425ae2a0a145f6c47cd0c1a9abfc31fb6e78c62ee63bfd33400777738b603e
MD5 b1d8a3e0bf0c1e1bf6746c5c4f39d978
BLAKE2b-256 69418934b304b8efb64fb6e5032094d5e6c694832700ea6c6c9f60f0c6d49c83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for yaml_to_markdown-0.1.1744598339-py3-none-any.whl
Algorithm Hash digest
SHA256 f5a4e6285c276effd97c4e428f06404327334d89b21338d31f83af3aae88b9fe
MD5 613a78a43f386ad9b366e2349b50cf22
BLAKE2b-256 ba8dc7d1737b8e0b6a6616df25593adf31bab92c384e4f1c2158bfde8a3899cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page