@tmlmt/cooklang-parser 1.0.8 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,12 +11,23 @@ The documentation is available at [https://cooklang-parser.tmlmt.com](https://co
11
11
  ## Features
12
12
 
13
13
  - **Cooklang Compliant:** Fully compliant with the Cooklang specifications.
14
- - **Useful modifiers:** in line with the same in the canonical cooklang parser in Rust ([cooklang-rs](https://github.com/cooklang/cooklang-rs/blob/main/extensions.md))
15
- - `@`: referenced recipe
16
- - `&`: referenced ingredient (quantities will be added)
17
- - `-`: hidden ingredient
18
- - `?`: optional ingredient
19
- - **Recipe Parsing:** Parse Cooklang recipes to extract metadata, ingredients, cookware, timers, and steps.
14
+ - **Recipe Parsing:** Parse Cooklang recipes to extract metadata, ingredients, cookware, timers, and steps. Several extensions on top of the original cooklang specifications:
15
+ - **Useful modifiers:** in line with the same in the canonical cooklang parser in Rust ([cooklang-rs](https://github.com/cooklang/cooklang-rs/blob/main/extensions.md))
16
+ - `@`: referenced recipe
17
+ - `&`: referenced ingredient (quantities will be added)
18
+ - `-`: hidden ingredient
19
+ - `?`: optional ingredient
20
+ - All but `@` also work with Cookware
21
+ - **Range values:**
22
+ - `@eggs{2-4}` will show eggs as an ingredient with a quantity range of 2 to 4
23
+ - `@water{1%L} and @&water{1/4-1/2%L}` will show water as an ingredient with a quantity range of 1.25 to 1.5 L
24
+ - Also works with Cookware and Timers
25
+ - **Cookware quantities:**
26
+ - Cookware can also be quantified (without any unit, e.g. `#bowls{2}`)
27
+ - Quantities will be added if cookware are referenced, e.g. `#&bowls{2}`
28
+ - **Ingredient aliases:**
29
+ - `@ingredientName|displayAlias{}` will add the ingredient as "ingredientName" in the ingredients list, but will display is as "displayAlias" in the preparation step.
30
+ - Also work with referencing etc., e.g. `Mix @wheat flour{100%g} with additional @&wheat flour|flour{50%g}` enables to get 150g of wheat flour in the ingredients list, and let you display "Mix wheat flour (100 g) with additional flour (50 g)" in your recipe renderer.
20
31
  - **Recipe Scaling:** Scale recipes by a given factor.
21
32
  - **Shopping Lists:** Generate shopping lists from one or more recipes.
22
33
  - **Aisle Configuration:** Categorize shopping list ingredients based on a custom aisle configuration.
@@ -91,13 +102,13 @@ console.log(shoppingList.categories);
91
102
 
92
103
  I plan to further develop features depending on the needs I will encounter in using this library in a practical application. The current todo includes:
93
104
 
94
- - Range values for ingredient quantities and timers
105
+ - Ingredients aliases. See issue tmlmt/cooklang-parser#5
95
106
 
96
107
  ## Test coverage
97
108
 
98
109
  This project includes a test setup aimed at eventually ensuring reliable parsing/scaling of as many recipe use cases as possible.
99
110
 
100
- You can run the tests yourself by cloning the repository and running `pnpm test`. To see the coverage report, run `pnpm run test:coverage`.
111
+ You can run the tests yourself by cloning the repository and running `pnpm test`. To see the coverage report, run `pnpm test:coverage`.
101
112
 
102
113
  If you find any issue with your own examples of recipes, feel free to open an Issue and if you want to help fix it, to submit a Pull Request.
103
114