Skip to main content

Python library for loading and dumping "yamldown" (markdown with embedded yaml) files.

Project description

# 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

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

yamldown-0.1.8.tar.gz (3.4 kB view details)

Uploaded Source

Built Distributions

yamldown-0.1.8-py3.7.egg (3.1 kB view details)

Uploaded Source

yamldown-0.1.8-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file yamldown-0.1.8.tar.gz.

File metadata

  • Download URL: yamldown-0.1.8.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for yamldown-0.1.8.tar.gz
Algorithm Hash digest
SHA256 ec1056e5ec3c47a7c14f69d343b73256ad12751361f1a833805a8ee722cf883c
MD5 bc60c60166ff21b130e4a2b5cc55dfe3
BLAKE2b-256 edcbb64a53c4ca6bd0e0aba74523b434213a5c6a3f583631dc4a97abfe7cc7a1

See more details on using hashes here.

File details

Details for the file yamldown-0.1.8-py3.7.egg.

File metadata

  • Download URL: yamldown-0.1.8-py3.7.egg
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for yamldown-0.1.8-py3.7.egg
Algorithm Hash digest
SHA256 6e9723d479739efa9423834fad005b31220b097ad42606dd0c8159e10677f27a
MD5 51c4e95392609f1edab9caf7badf8eed
BLAKE2b-256 074578cc7385153a9332d88b76a8cd7a72143974dce66acb2ef9957c0149155d

See more details on using hashes here.

File details

Details for the file yamldown-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: yamldown-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for yamldown-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 936ad7bdbde725d0bd3adb77236aae4eb75388619f31232595f7dd45f7006598
MD5 db0f9fc6a788876dfc8288d9ba8334ef
BLAKE2b-256 5a40b8aa35f5ef831a1d47668cc63c6a29611b5b91a9076fddb3fa5368582a67

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