Skip to content

Create a single md file from a directory full of code files

Notifications You must be signed in to change notification settings

realKarthikNair/Code-to-md

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Code-to-md

inspired from code_to_md by @Dinex-dev

Generate a markdown file from a folder of programs, each program numbered with the first comment as title and the rest as code block

1. Why?

To generate a file like this from a directory filled with programs.

2. How to set-up

Method 1: Clone the repo

    git clone https://github.com/realKarthikNair/Code-to-md
    cd Code-to-md

Method 2: Download zip and extract it

3. Usage

./code-to-md.py -idir <path-to-code-directory> -e <extension> -odir <md-file-destination> -o <md-filename>

for example,

./code-to-md.py -idir /home/karthik/Temp/python/new/programs/ -e .py -odir /home/karthik/Temp/python/ -o programs.md

To choose <current directory/programs> as code dir and <current directory> as markdown location without any further prompts

./code-to-md.py -d

The script also has a CLI-based interface, so you can even skip entering path as shell arguments

The default code directory is <current working directory>/programs/ and the default output directory is <current working directory>/

I personally have this script placed at /usr/local/bin so that I can use it from anywhere

Okay so that's it: Enjoy!

4. How to reach me?

Incase you want to buy me a coffee...

Coindrop.to me