@tmlmt/cooklang-parser / Metadata
Interface: Metadata
Represents the metadata of a recipe.
Indexable
[
key:string]:MetadataValue
Index signature for additional metadata fields not explicitly typed. Any metadata key in the frontmatter will be captured here.
Properties
author?
optionalauthor?:string
The author of the recipe (separate from source author).
category?
optionalcategory?:string
The category of the recipe.
course?
optionalcourse?:string
The course of the recipe.
cuisine?
optionalcuisine?:string
The cuisine of the recipe.
description?
optionaldescription?:string
The description of the recipe.
diet?
optionaldiet?:string
The diet of the recipe.
difficulty?
optionaldifficulty?:string
The difficulty of the recipe.
image?
optionalimage?:string
The primary image of the recipe.
images?
optionalimages?:string[]
The images of the recipe.
introduction?
optionalintroduction?:string
The introduction of the recipe.
locale?
optionallocale?:string
The locale of the recipe.
serves?
optionalserves?:string|number
The number of people the recipe serves. Stored as a number when the value is numeric, or as a string when non-numeric (e.g. serves: two). Non-numeric values default the internal scaling baseline to 1.
Interchangeable with servings or yield for the purpose of setting Recipe.servings. If multiple ones are defined, the prevalence order is servings > serves > yield.
Example
serves: 4servings?
optionalservings?:string|number
The number of servings the recipe makes. Stored as a number when the value is numeric, or as a string when non-numeric (e.g. servings: two). Non-numeric values default the internal scaling baseline to 1.
Interchangeable with yield or serves for the purpose of setting Recipe.servings. If multiple ones are defined, the prevalence order is servings > serves > yield.
Example
servings: 4source?
optionalsource?:string|MetadataSource
The source of the recipe. Can be a simple URL string or structured attribution. When parsed from YAML, source.name, source.url, source.author keys are merged here.
tags?
optionaltags?:string[]
The tags of the recipe.
time?
optionaltime?:MetadataTime
Time information for the recipe. When parsed from YAML, prep time, time.prep, cook time, time.cook, time required, time, duration keys are merged here.
title?
optionaltitle?:string
The title of the recipe.
unitSystem?
optionalunitSystem?:string
The unit system used in the recipe for ambiguous units like tsp, tbsp, cup. See Unit Conversion Guide for more information. This stores the original value as written by the user.
variants?
optionalvariants?:string[]
The list of available variant names for this recipe.
yield?
optionalyield?:Yield
The yield of the recipe. Can be given as:
- a plain quantity with optional unit:
yield: 300%goryield: 2 - a complex format with
and optional surrounding text:yield: about NaN of bread
Interchangeable with servings or serves for the purpose of setting Recipe.servings. If multiple ones are defined, the prevalence order is servings > serves > yield.
Examples
yield: 300%gyield: about {{300%g}} of bread