Metadata-Version: 2.3
Name: dumas
Version: 0.0.6
Project-URL: Documentation, https://github.com/aleivag/dumas#readme
Project-URL: Issues, https://github.com/aleivag/dumas/issues
Project-URL: Source, https://github.com/aleivag/dumas
Author-email: Alvaro Leiva Geisse <aleivag@gmail.com>
License-Expression: MIT
License-File: LICENSE.txt
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.10
Requires-Dist: black
Requires-Dist: click
Requires-Dist: ipython
Requires-Dist: libcst
Requires-Dist: marko
Requires-Dist: pydantic
Description-Content-Type: text/markdown

# dumas

[![PyPI - Version](https://img.shields.io/pypi/v/dumas.svg)](https://pypi.org/project/dumas)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/dumas.svg)](https://pypi.org/project/dumas)

* * *

**Table of Contents**

- [Installation](#installation)
- [License](#license)

## Installation

```console
pip install dumas
```

## Using it (prepare your doc)

Using dumas on any markdown file will leave the file almost unchanged,
we use [marko](https://github.com/frostming/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

```markdown

\```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:

```shell
$ dumas render-file example.md
```

and this will output to stdout:

```python

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


Out[1]: 4
```

you can write to specific file

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

or render the entire files of a dir into another

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

## Using it (api)

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

```python
# 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

\```
```

```python

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](https://spdx.org/licenses/MIT.html) license.
