Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anevis/yaml-to-markdown
A Python utility to take a JSON / YAML file or a python dict / list and create a Markdown file.
https://github.com/anevis/yaml-to-markdown
converter json markdown md python yaml
Last synced: about 1 month ago
JSON representation
A Python utility to take a JSON / YAML file or a python dict / list and create a Markdown file.
- Host: GitHub
- URL: https://github.com/anevis/yaml-to-markdown
- Owner: anevis
- License: mit
- Created: 2024-04-05T00:16:28.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-04-08T12:19:07.000Z (7 months ago)
- Last Synced: 2024-04-09T05:02:45.686Z (7 months ago)
- Topics: converter, json, markdown, md, python, yaml
- Language: Python
- Homepage: https://anevis.github.io/json-to-markdown/
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# YAML to Markdown Converter
A Python utility to take a JSON / YAML file or a python dict / list and create a Markdown file.
## Installation
```bash
pip install yaml-to-markdown
```## Usage
```bash
$ yaml-to-markdown --help
Convert JSON or YAML to Markdown.
Usage: yaml-to-markdown -o [-y | -j ]
-o, --output-file : Path to the output file as a string [Mandatory].
-y, --yaml-file : Path to the YAML file as a string [Optional]
-j, --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:
```python
from yaml_to_markdown.md_converter import MDConverterdata = {
"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:
```markdown
## 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:
```bash
yaml-to-markdown --output-file output.md --json-file test.json
```#### Convert a YAML file to Markdown:
```bash
yaml-to-markdown --output-file output.md --yaml-file test.yaml
```## Developer Guide
Please see the [DEVELOPER.md](docs/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](LICENSE) file for details.