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 any markdown file will leave the file almost unchanged, 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 [1]: import textwrap
   ...: from dumas.lib.renderer import render_text, render_file
   ...: 
   ...: 
   ...: MD_TEXT = textwrap.dedent(
   ...:     """
   ...:         This is a regular MD
   ...:         ====================
   ...:         
   ...:         with some `funny text` and some text
   ...:         
   ...:         ```dumas[python@readme]
   ...:         x = 1+1
   ...:         
   ...:         x**2
   ...:         
   ...:         ```
   ...:     """
   ...: )
   ...: 
   ...: MD_TEXT


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

with some `funny text` and some text

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

x**2

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


Out[2]: 
# This is a regular MD

with some `funny text` and some text

\```python

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


Out[1]: 4
\```

Interpreters

dumas comes with a python interpreter, I plan to expand interpreters as I need them.

Contributing and a usage warning

Yes please, but not a lot... I'nm the only one mantaining this project, I'm mostly making it for me, and i want to be able to change the interfaces without breaking the world, please

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.6.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

dumas-0.0.6-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file dumas-0.0.6.tar.gz.

File metadata

  • Download URL: dumas-0.0.6.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.26.0

File hashes

Hashes for dumas-0.0.6.tar.gz
Algorithm Hash digest
SHA256 2295c9db601fde49cfc09ea8fcdc7f6beee819f80fcceb667327c8d0b9466ce9
MD5 489341964ab91d247707e7d1a756e498
BLAKE2b-256 a5446a04edc742d9ebf2c6af33e49aceebca69ef11bc8d7d376dd405bdf86b6d

See more details on using hashes here.

File details

Details for the file dumas-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: dumas-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.26.0

File hashes

Hashes for dumas-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ac4f24765542fc60c84ffa5650eb414089a3d09f47c090db4cc464ae065f7dce
MD5 91771f3716e2bac84dc92c72730920eb
BLAKE2b-256 c2dd7f58b7fc80e36f7a89295ce5022c442efc63d46cf0f396ca18c56231c32f

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