Skip to content

husky-dev/md2snipp

Repository files navigation

Markdown to VSCode snippets

npm version License: MIT Lint Test

Tool for generating VSCode snippets from markdown files.

Motivation

Snippets are cool! They help to save programmers time and fingers. VSCode is cool too. But it is hard to store, manage and edit multiline snippets. The JSON format is easy. But when you have a lot of snippets with a lot of lines - it is hard to review and edit them. You just don't want to edit snippets cos you will have to have a deal with JSON's array, indents, and correct commas. Over time, you starting to forget snippets and you have to review JSON to recall them. The solution to which I come is to store snippets into readable Markdown and convert it to JSON.

Markdown to VSCode snippets

Installation

npm isntall -g md2snipp

Or use with npx:

npx md2snipp --help

Usage

Create a folder with .md files and with the next format:

Markdown to snippets example

I usually use .vscode/snippets folder for it.

Then run next command:

npx md2snipp --root .vscode/snippets --output .vscode

The tool will look for a .md files at .vscode/snippets, will convert it to .code-snippets files, and will output a result to .vscode. It distinguishes separate snippets by the **Prefix** keyword and by and of the code block. You can add any other text and comments. The tool will look only for the keywords and snippet's body.

In this example, you are able to keep .md files next to the project, share them with teammates, and easily review them right at GitHub.

The tool can also convert separate files:

npx md2snipp --root .vscode/snippets --output .vscode basic.md

Read help for more options:

npx md2snipp --help

About

Tool for generating VSCode snippets from markdown files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published