Git Product home page Git Product logo

md2csv's Introduction

Markdown list to CSV Converter

Small script to convert an unordered markdown list copyed to the clipboard into a csv file. The seperator will be a pipe (|). The first column will be the question and the second column will be the answer. The output file will be overwritten every time the script is run.


Use Case

While studing I write dwon questions and answers to the toppics I'm studying in obsidian. I use the script to convert the list to a csv file that I can import into anki.


Setup

Run the following command to install pyperclip:

If pip is in your path:

pip install -r requirements.txt

If pip is not in your path:

python3 -m pip install -r requirements.txt

Make the script executable:

chmod +x ["path to script"]/md2csv.py

Add the script to your path:

To add the script to your path, run the following command:

sudo ln -s ["path to script"]/md2csv.py /usr/local/bin/md2csv

Change the following line to the desired full path of your desired output file or delete the path and outcomment the input line to be asked for the path every time you run the script:

csv_filename = "output/import-to-anki.csv" #input("Please enter the path of the CSV file to be created: ")

Now you can run the script from anywhere with the command:

md2csv

Usage

The list should be ordered like this:

- Question 1
    - Answer 1
- Question 2
    - Answer 2

To use the script, copy the list to the clipboard and run the script from your terminal with the command:

md2csv

If you did not change the path for the output file, The output will be in a folder called "output" witht the filename "import-to-anki.csv" in the same directory as the script. Import that file into anki.

md2csv's People

Contributors

fabiankohlhaas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.