Skip to main content

Generate Markdown text from templates.

Project description

RenderDown

Build Status

Generate Markdown text from templates; that is, the result of rendering is Markdown text, not HTML. This is useful for generating documents published on a Markdown platform like GitHub Wikis.

Usage

The simplest way to use RenderDown is to invoke it from the commandline:

renderdown.py TEMPLATE [--assign KEY=VALUE] [--outdir OUTDIR]

The required TEMPLATE argument is the path to a template file. Simple variables may be passed to the template with the --assign option. If the --outdir option is set, multi-file documents can be created, written to files in the output directory; if unset, the multiple pages are appended together and printed to stdout.

RenderDown can also be used as a library. The API.md file (generated using RenderDown and CartogrAPI) is a reference of RenderDown's API.

Templates

Templates are rendered with Mako. A doc variable is added to the namespace of all templates (see API.md for a description of the functions on doc). For example, if mytemp.mako is a template defined as follows:

# ${title}

Here are two bullet points:
${ doc.listitem("the first point") }
${ doc.listitem("note how wrapped lines\nare indented") }

${ doc.blockquote(
    "the same is true for blockquotes, except the > character is\n"
    "repeated on the wrapped lines.")
}

The the following call the RenderDown will render the template:

$ python renderdown.py example.md --assign title="Hello World"
# Hello World

Here are two bullet points:
* the first point
* note how wrapped lines
  are indented

> the same is true for blockquotes, except the > character is
> repeated on the wrapped lines.

The original use case for rendering Markdown is for publishing Python API documentation on GitHub Wikis, so the default templates target that platform.

The templates are defined for rendering packages, modules, classes, methods, and functions in a fairly generic way (inspired by documentation), but they can be reconfigured and specialized for individual projects.

Requirements

How to Test

Run the following command to test:

$ pip install -r requirements.txt   # install dependencies
$ pip install -e .                  # to import in tests
$ python setup.py test              # run the test cases

License

MIT; see LICENSE for more information.

Project History

This project was created by Michael Wayne Goodman (@goodmami) and is now owned and maintained by Jeff Hung (@jeffhung).

Links

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

renderdown-0.2.0.tar.gz (6.5 kB view details)

Uploaded Source

File details

Details for the file renderdown-0.2.0.tar.gz.

File metadata

  • Download URL: renderdown-0.2.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/2.7.10

File hashes

Hashes for renderdown-0.2.0.tar.gz
Algorithm Hash digest
SHA256 15c3f5166040bf7d192c4cf6eacd5b0df917a2ec7376d899bdf79056db26f2f4
MD5 c4ba462306cb8b9005ebc8e856741520
BLAKE2b-256 1e939198f747d9656bfecb9f6d87d8b2c950e17b06677567f38afda856b04794

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page