Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

markdgenerator-0.0.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

markdgenerator-0.0.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for markdgenerator-0.0.2.tar.gz
Algorithm Hash digest
SHA256 565031d5802013fe1c8f219118dc83a160ed15ee4da0a5b0ddb2597ae1a1e97c
MD5 ee9c1a6c0ed1cbe9b1f44d902bd544fc
BLAKE2b-256 f7f9bf6fa510c99efc31be918bcd40c736ed9564209451bf6e3570b42dc81a3d

See more details on using hashes here.

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

Hashes for markdgenerator-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a58d028fa46ba73343d62c65ff9938ed584cf94c1af2f81d831f8fc5907b348b
MD5 330f880850066cff2a4080b539713728
BLAKE2b-256 956bd4fb9a6258289bab8bea7636a9980651dec30551b11df17ecb7606f16906

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