0.4.0 • Published 4 months ago

markdown-it-cooklang v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

markdown-it-cooklang

An early incomplete implementation of cooklang.org for markdown-it.

For now implemented are:

  • Ingredients. The placehloder [[ingredients]] in your text will be replaced by a list of all of your ingredients.
  • Cookware. The placeholder [[cookware]] in your text will be replaced by a list of all of your cookware.

Missing implementation:

  • Timers
  • Comments
  • Metadata
  • Shopping list specification

I used the logic for a different thing than a cooking recipe. Instead, I described on my 11ty powered website the process of building a bicycle with all required ingredients (parts), and cookware (tools). See Fairlight Strael Build Notes. At the end of the document you see a list of parts to order and tools to use. Those lists are created by using markdown-it-cooklang.

Install

npm i markdown-it-cooklang

Usage

var markdownIt = require("markdown-it");
var markdownItCooklang = require("markdown-it-cooklang");

markdownIt({
  html: true,
}).use(markdownItCooklang);

Configuration

The default configuration is

{
    ingredient: {
      startWith: "@",
      inlineDisplayName: true,
      inlineDisplayAmount: false,
      singular: "ingredient",
      plural: "ingredients",
    },
    cookware: {
      startWith: "#",
      inlineDisplayName: true,
      inlineDisplayAmount: false,
      singular: "cookware",
      plural: "cookware",
    },
    timer: {
      startWith: "~",
      inlineDisplayName: false,
      inlineDisplayAmount: true,
      singular: "timer",
      plural: "timers",
    }
}

You can create a configuration object that adjusts all or some of the above settings, and pass that configuration object to markdown-it-cooklang during setup:

// configuring aspects of markdown-it-cooklang
var markdownIt = require("markdown-it");
var markdownItCooklang = require("markdown-it-cooklang");

markdownIt({
  html: true,
}).use(markdownItCooklang, {
  ingredients: {
    inlineDisplayAmount: true,
  },
});
0.4.0

4 months ago

0.3.0

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.2.0

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago