Expand description
§Recipe Extraction from HTML documents
reget provides a single function to extract a recipe from HTML documents
using structured data (JSON-LD) embedded within.
With the optional markdown feature, recipes can be converted to a markdown string.
This library assumes the document follows the schema.org recipe specification.
§Example
use reget::parse_recipe;
let html = r#"
<!DOCTYPE html>
<html lang="en">
<script type="application/ld+json">
{
"@type": "Recipe",
"name": "Delicious Cookies",
"author": "Lorem Ipsum",
"recipeIngredient": ["2 cups flour", "1 cup sugar"],
"recipeInstructions": "Mix ingredients and bake."
}
</script>
</html>
"#;
let recipe = parse_recipe(html).unwrap();
// And with the optional markdown feature
let md = recipe
.to_markdown()
.with_url("https://example.org/recipe")
.convert();Structs§
- HowTo
Section - A collection of how-to-steps with an optional name
- Markdown
Builder - A builder to convert the contents of a recipe a markdown string
- Recipe
- A recipe extracted from HTML using parse_recipe.
Functions§
- parse_
recipe - Parses the recipe from the given HTML document. Will return None if no linked data is found in the document.
Type Aliases§
- HowTo
Step - A single how-to-step of a recipe
- Ingredient
- A single ingredient used in a recipe