Skip to main content

No project description provided

Project description

dumas

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install dumas

Using it (prepare your doc)

using dumas on a regular markdown file has very little change, we use marko under the hood and marko is opinionated on what gets output from a markdown document. but the power of dumas start when you use the dumas blocks, right now there is only the "dumas fenced code block" (the one with the backticks). Just add to your document this

\```dumas[python]
a = 1
def foo(o):
   return 2**o

foo(a+1)

\```

and this will turn the content into an ipython (jupyter notebook) cell.

Using it (cli)

then execute:

$ dumas render-file example.md

and this will output to stdout:

In [1]: a = 1
   ...: 
   ...: 
   ...: def foo(o):
   ...:     return 2**o
   ...: 
   ...: 
   ...: foo(a + 1)


Out[1]: 4

you can write to specific file

$ dumas render-file example.md --output-file  /tmp/myfile.md

or render the entire files of a dir into another

$ dumas render-dir docs/ --output-dir  publish/

Using it (api)

You could use dumas as part of your own workflow/program

# First import the render functions


In [2]: from dumas.lib.renderer import render_text, render_file
   ...: import textwrap
   ...: 
   ...: MD_TEXT = textwrap.dedent(
   ...:     """
   ...:     This is a regular MD
   ...:     ====================
   ...:     
   ...:     with some `funny text` and some text
   ...:     
   ...:     ```dumas[python@readme]
   ...:     x = 1+1
   ...:     
   ...:     x**2
   ...:     
   ...:     ```
   ...: """
   ...: )
In [3]: MD_TEXT


Out[3]: 
This is a regular MD
====================

with some `funny text` and some text

\```dumas[python@readme]
x = 1+1

x**2

\```
In [4]: render_text(MD_TEXT)


Out[4]: 
# This is a regular MD

with some `funny text` and some text

\```python

In [1]: x = 1 + 1
   ...: 
   ...: x**2


Out[1]: 4
\```

License

dumas is distributed under the terms of the MIT license.

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

dumas-0.0.5.tar.gz (5.6 kB view hashes)

Uploaded Source

Built Distribution

dumas-0.0.5-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

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