Skip to main content

Package to generate different kind of markdown texts

Project description

MD Generator (mdgenerator)

mdgenerator is a package to generate different kinds of markdown texts

Following details the functionality provided by the package:

  • Generate File Structure Trees in Markdown
  • Generate Tables in Markdown from pandas dataframe or python arrays

Installation

There are two ways to install mdgenerator:

  • Install mdgenerator from PyPI (recommended):
pip install mdgenerator
  • Install mdgenerator from the Github source:
git clone https://github.com/nilansaha/mdgenerator.git
cd mdgenerator
pip install .

Usage

  • Generate File Tree Structure in Markdown

    • Using Python
     from mdgenerator import generate_file_structure
    
     generate_file_structure(target_dir='/path/to/directory', output_dir='/output/directory')
    
    • Using the terminal
     mdgenerator --target_dir "/path/to/directory" --output_dir "/output/directory"
    

    Output is stored in file_structure.md in the specified output_dir

    Sample Output -

     ├── .DS_Store
     ├── mdgenerator.py
     ├── __init__.py
     ├── test.py
     ├── cli.py
     ├── file-structure.md
     ├── ABC
     |   ├── a.txt
     |   ├── BCD
     |   |   ├── b.txt
     ├── __pycache__
     |   ├── mdgenerator.cpython-37.pyc
    
  • Generate Markdown Table using Python

    • Using Python lists
     from mdgenerator import generate_table
    
     data = [['Word_1','Word_2'],['Happy','Sad'],['Nice','Bad']]
     table = generate_table(data)
     print(table)
    

    Output

    Word_1 Word_2
    Happy Sad
    Nice Bad
    • Using Pandas DataFrame
     import pandas as pd
     from mdgenerator import generate_table
    
     df = pd.DataFrame([['Happy','Sad'], ['Nice','Bad']], columns = ['Word_1','Word_2'])
     table = generate_table(df)
     print(table)
    

    Output

    Word_1 Word_2
    Happy Sad
    Nice Bad

Project details


Release history Release notifications

Download files

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

Files for mdgenerator, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size mdgenerator-0.1.0-py3-none-any.whl (7.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size mdgenerator-0.1.0.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page