This project aims to automate the process of creating Anki cards. To create cards, in batch, you can write a simple LaTeX document which is then transformed into markdown and csv file. The latter is used to be imported into Anki. The former is simplified LaTeX document for reading without compiler LaTeX document.
Easy to use command line interface for creating a template that is used to batch write Anki cards in LaTeX format. Although not necessary, yet very handy and time saving. You can easily create Anki cards using txmanipulator.
- Node.js
- TypeScript
- commander.js
To get started you need installed Node.js LTS 14.x or later alongside other tools.
- Node.js LTS 14.x or later
- TypeScript
- Install Node.js
- Clone the repo
git clone https://github.com/janmerhar/txtemplate
- Install NPM packages
npm install
- Install TypeScript
npm install typescript -g
- Run TypeScript compiler
npm run build
- Compiled JavaScript code will be available inside
dist
folder.
Script is located in bin
folder. You can run it with ts-node
. Note, if you want to run JavaScript script, you will find compiled executable in dist/bin
folder.
To use CLI you need to install package from NPM using npm install txtemplate -g
. Afterwards you can run the CLI using txtemplate
command.
Usage: template [options]
Options:
-f, --file-name <strings...> Name of the LaTeX output file
-t, --title <string...> Title given by the user
-d, --date <strings...> Date given by the user (default: "2021-07-27")
-a, --author <strings...> Author(s) (default: "")
-p, --packages <strings...> packages added to \usepackage
-s, --sections <number> Number of sections in the document
-h, --help display help for command
import { LaTeXTemplate } from "txtemplate"
const latex = new LaTeXTemplate("name_of_output_file.tex")
latex
// Set packages to be present in LaTeX document
.setPackages(["booktabs", "cleveref", "microtype"])
// Set authhor's name, date, and title of document
.setTitleData("Author's name", "Date of creation", "Title of document")
// Write \begin LaTeX tag
.setBeginDocument()
// Write n \section tags
.setSections("Number of sections: int")
// Write the template to .tex file
.writeToFile()
// Run written .tex file in a passed program
.openCreatedDocument("code")
To contribute to this project follow these steps:
- Fork the repository
- Create feature branch (
git checkout -b feature/NewFeature
) - Commit changes (
git commit -m 'Add some changes'
) - Push to the branch (
git push origin feature/NewFeature
) - Open a pull request