Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

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

Release History

Release History

This version
History Node

0.1.2

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
yamldown-0.1.2.tar.gz (3.2 kB) Copy SHA256 Checksum SHA256 Source Apr 20, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting