npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

mdanki

v1.1.2

Published

Convert markdown files to anki cards

Downloads

38

Readme

MDAnki

Converts Markdown file(s) to the Anki cards.

Requirements

Node.js v10.0+

Install

npm install -g mdanki

Usage

Convert a single markdown file:

mdanki library.md anki.apkg

Convert files from directory recursively:

mdanki ./documents/library ./documents/anki.apkg

Using all available options:

mdanki library.md anki.apkg --deck Library --config config.json

Import just generated .apkg file to Anki ("File" - "Import").

Overriding default settings

To override default settings use --config option:

mdanki library.md anki.apkg --config faworite-settings.json

Supported files

MDAnki supports .md and .markdown files.

Cards

By default, MDAnki splits cards by ## headline. For example, below markdown will generate 2 cards where headlines will be on the front side and its description - on the back.

## What's the Markdown?

Markdown is a lightweight markup language with plain-text-formatting syntax.
Its design allows it to be converted to many output formats,
but the original tool by the same name only supports HTML.

## Who created Markdown?

John Gruber created the Markdown language in 2004 in collaboration with
Aaron Swartz on the syntax.

If you want to have multiple lines on the card's front side - use % symbol for splitting front and back sides:

## YAGNI

Describe this acronym and why it's so important.

%

"You aren't gonna need it" (YAGNI) is a principle of extreme programming
(XP) that states a programmer should not add functionality until deemed
necessary.

When parsing only one markdown file, the title of the deck could be generated based on the top-level headline (# ).

Tags

Cards can have tags in their markdown sources. For adding tags to cart it should follow some rules:

  • tags start from a new line
  • only one line with tags per card
  • a tag should be written in the link format
  • tag (link text) should start from # symbol

MDAnki uses '^\\[#(.*)\\]' pattern for searching tags. This pattern could be overwritten by specifying custom settings. The source file in the tag link is optional.

The below example will generate a card with 3 tags: algorithms, OOP, and binary_tree.

## Binary tree

In computer science, a binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child.

[#algorithms](./algorityms.md) [#OOP]() [#binary tree]()

Code and syntax highlighting

Code blocks can be written with and without specifying a language name:

The last code block will be treated by MDAnki as Bash code. The default language can be configured by specifying --config with an appropriate defaultLanguage setting.

Note! Creating a block without language name is not fully supported and should be eliminated in usage. Take a look at this:

echo "Code block with language name"
echo "Code block without language name"

Supported languages

MDAnki supports code highlighting for these languages:

actionscript, applescript, aspnet, bash, basic, batch, c, coffeescript, cpp, csharp, d, dart, erlang, fsharp, go, graphql, groovy, handlebars, java, json, latex, less, livescript, lua, makefile, markdown, markup-templating, nginx, objectivec, pascal, perl, php, powershell, python, r, ruby, rust, sass, scheme, smalltalk, smarty, sql, stylus, swift, typescript, vim, yaml.

Images

You can use links to image files inside markdown, MDAnki will parse them and add those images to the import collection. It's allowed to use two styles for writing images:

  1. Inline: alt text

  2. Reference: alt text

LaTeX

MDAnki and Anki can support LaTeX. Install LaTeX for your OS and use the [latex] attribute within Markdown files.

[latex]\\[e^x -1 = 3\\][/latex]

User settings

Any configuration which is presented in settings file could be overwritten by specifying an external configuration file:

mdanki markdown.md aki.apkg --config path/to/config/file.js

Memory limit

Converting a big Markdown file you can get a memory limit error like this:

Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 16777216...

For overcoming this error, replace sql.js:

cp node_modules/sql.js/js/sql-memory-growth.js node_modules/sql.js/js/sql.js

More info here.

License

MIT License, Copyright (c) 2020, Oleksandr Shlinchak.

Changelog

Changelog