# Yamldown
This library allows users to load and read “YAMLdown” files. That is, Markdown (primarily for github) with YAML embedded inside. Github markdown already renders YAML style text in markdown as a table. This library parses a yamldown file into its respective YAML and markdown.
## Installation
pip install yamldown
For local installation and development, you can run the make file:
sauron@orthanc:[~]$ cd yamldown sauron@orthanc:[yamldown]$ make
This will create a virtual environemnt env, install everything in requirements.txt and in setup.py, run tests, and run mypy, python 3’s type checker. Be sure to activate the virtual environment when local developing:
source env/bin/activate
or
. env/bin/activate
To undo your activated virtual environment, just run the command deactivate
## Usage
Importing the yamldown module will let you load and dump yamldown files. load receives a file-like object (backed by text in yamldown format) and returns a tuple, first a dictionary with the containing YAML, and second a string with the contents of the Markdown. In this way the yaml can be utilized.
Example:
$ python3 >>> import io >>> import yamldown >>> s = “”” …— … things: … - hello … - world … foo: bar … — … This is some markdown text””” >>> f = io.StringIO(s) >>> yml, md = yamldown.load(f) >>> print(yml) {‘things’: [‘hello’, ‘world’], ‘foo’: ‘bar’} >>>print(md) This is some markdown text
To write out a yamldown file, dump takes a dictionary with your yaml data and a string of markdown and outputs a string. The order in which the yaml appears in the document can be specified with the yamlfirst option: True for if the yaml should appear first (like in the above example) and False to appear last.
Example:
$ python3 >>> import yamldown >>> yml = {‘things’: [‘hello’, ‘world’], ‘foo’: ‘bar’} >>> md = “This is some markdown text” >>> print(yamldown.dump(yml, md)) — foo: bar things: - hello - world
— This is some markdown text
Release files for yamldown 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yamldown-0.1.8.tar.gz | 3.4 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yamldown-0.1.8-py3.7.egg | Legacy Egg format | - | - | Details |
| yamldown-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.6 kB
Release files / yamldown-0.1.8.tar.gz
| Download URL | yamldown-0.1.8.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec1056e5ec3c47a7c14f69d343b73256ad12751361f1a833805a8ee722cf883c
|
|
BLAKE2b-256 checksum How to use checksums |
edcbb64a53c4ca6bd0e0aba74523b434213a5c6a3f583631dc4a97abfe7cc7a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
|
Release files / yamldown-0.1.8-py3.7.egg
| Download URL | yamldown-0.1.8-py3.7.egg |
|---|---|
| Size | 3.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
6e9723d479739efa9423834fad005b31220b097ad42606dd0c8159e10677f27a
|
|
BLAKE2b-256 checksum How to use checksums |
074578cc7385153a9332d88b76a8cd7a72143974dce66acb2ef9957c0149155d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
|
Release files / yamldown-0.1.8-py3-none-any.whl
| Download URL | yamldown-0.1.8-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
936ad7bdbde725d0bd3adb77236aae4eb75388619f31232595f7dd45f7006598
|
|
BLAKE2b-256 checksum How to use checksums |
5a40b8aa35f5ef831a1d47668cc63c6a29611b5b91a9076fddb3fa5368582a67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
|