Skip to main content

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.

Metadata

Release files for yaml-to-markdown 0.1.1712544465

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yaml-to-markdown 0.1.1712544465
File Size Uploaded
yaml-to-markdown-0.1.1712544465.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yaml-to-markdown 0.1.1712544465
File Interpreter ABI Platform
yaml_to_markdown-0.1.1712544465-py3-none-any.whl Python 3 none any Details

Total release size: 16.7 kB

Release files / yaml-to-markdown-0.1.1712544465.tar.gz

Download URL yaml-to-markdown-0.1.1712544465.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c8d59cdc4a382fcca8d20a1039262ef57493e7d4c696a801f152a79d3a423122
BLAKE2b-256 checksum
How to use checksums
1b82130b92e88fbc4e2f146b863a2783af30e654d38755bbef4357a40e660651
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / yaml_to_markdown-0.1.1712544465-py3-none-any.whl

Download URL yaml_to_markdown-0.1.1712544465-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e4a3d40667351814b25e8200f10f7845f291795086e86e8a0bae64caaad888c
BLAKE2b-256 checksum
How to use checksums
326d40a740efa6bfd65790d29caab6bf3f1f23876c8694850b53a1e1d33764fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page