Expand description
A library for parsing recipes written in markdown that follows the RecipeMD specification.
This implementation tries to be as close as possible to the specification. This results in some differences to the reference implementation written in Python. See the related issue for details.
Example
const MARKDOWN: &str = r#"# Water
A refreshing drink that should be consumed several times a day.
*drink, non-alcoholic, H2O*
**1 glass**
---
- *1* glass
- *1* faucet
---
Turn on the faucet and fill the glass.
"#;
let recipe = Recipe::parse(MARKDOWN)?;
println!("{recipe:#?}");
Result of the above program
ⓘ
Recipe {
title: "Water",
description: Some(
"A refreshing drink that should be consumed several times a day.",
),
tags: Some(
[
"drink",
"non-alcoholic",
"H2O",
],
),
yields: Some(
[
Amount {
factor: Some(
Integer(
1,
),
),
unit: Some(
"glass",
),
},
],
),
ingredients: [
IngredientGroup {
title: None,
ingredients: [
Ingredient {
amount: Some(
Amount {
factor: Some(
Integer(
1,
),
),
unit: None,
},
),
name: "glass",
link: None,
},
Ingredient {
amount: Some(
Amount {
factor: Some(
Integer(
1,
),
),
unit: None,
},
),
name: "faucet",
link: None,
},
],
},
],
instructions: Some(
"Turn on the faucet and fill the glass.",
),
}
(If it doesn’t show up, visit the docs instead)
Structs
- An Amount used for ingredients and yields.
- Returned if a parsing a recipe was not successful.
- An Ingredient.
- An IngredientGroup.
- A Recipe as defined by the RecipeMD specification.
Enums
- The exact reason why parsing of the recipe failed.
- Represents the numerical part of an
Amount
.
Type Definitions
- Type alias for
Result<T, recipemd::Error>
.