md-macros
1 min read • 134 words
Markdown is great for its simplicity and easy-to-read syntax. Sometimes you want to embed rich markup or components inside of a markdown document. How do you do this without writing ugly html along side your content?
Enter md-macros, an npm package that I created and use myself on this blog. It allows me to link from one post to another with \\[[postLink slug="welcome-2"]]
, embed a youtube video with \\[[youtubeEmbed url="<youtube video url>"]]
, and keep my markdown documents clean and free of html.
Each macro maps to a simple JavaScript function, making this a highly extensible library. I use it in other projects to embed a table of contents inside of the README.
Check out the code on my github, or use it in one of your projects by installing the npm package.