Package to generate text in pandoc markdown language
Project description
markdgenerator
This is a short library to help generate text in pandoc markdown language with.
So far, it supports:
- h1, h2, h3 headings
- paragraphs
- code blocks
- tables in grid_table format
- also generated from a pandas DataFrame
It's extendable to support more markdown languages.
Output of the tool can be converted into multiple document formats using pandoc and its --from=markdown option
Installation
pip install markdgenerator
Example usage
from markdgenerator import PandocMdGenerator
import pandas as pd
generator = PandocMdGenerator()
generator.h1("Example")
generator.paragraph("Pandas dataframe example")
generator.add_block_to_section()
df = pd.DataFrame(
columns=["car", "price"],
data=[["vw", 10000], ["bmw", 20000], ["mercedes", 30000]])
generator.df_to_table(df)
generator.add_table_to_section()
print(generator)
which leads to:
# Cars
This document lists prices of german cars.
+--------+-----+
|car |price|
+========+=====+
|vw |10000|
+--------+-----+
|bmw |20000|
+--------+-----+
|mercedes|30000|
+--------+-----+
This can be passed to pandoc and converted to a different format.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file markdgenerator-0.0.2.tar.gz.
File metadata
- Download URL: markdgenerator-0.0.2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
565031d5802013fe1c8f219118dc83a160ed15ee4da0a5b0ddb2597ae1a1e97c
|
|
| MD5 |
ee9c1a6c0ed1cbe9b1f44d902bd544fc
|
|
| BLAKE2b-256 |
f7f9bf6fa510c99efc31be918bcd40c736ed9564209451bf6e3570b42dc81a3d
|
File details
Details for the file markdgenerator-0.0.2-py3-none-any.whl.
File metadata
- Download URL: markdgenerator-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a58d028fa46ba73343d62c65ff9938ed584cf94c1af2f81d831f8fc5907b348b
|
|
| MD5 |
330f880850066cff2a4080b539713728
|
|
| BLAKE2b-256 |
956bd4fb9a6258289bab8bea7636a9980651dec30551b11df17ecb7606f16906
|