Crates.io | sweet-potator |
lib.rs | sweet-potator |
version | 0.7.7 |
source | src |
created_at | 2022-03-16 16:32:19.636014 |
updated_at | 2024-06-05 14:48:56.569942 |
description | Static recipe site generator |
homepage | https://github.com/tobx/sweet-potator |
repository | https://github.com/tobx/sweet-potator |
max_upload_size | |
id | 551281 |
size | 459,860 |
Sweet Potator is a static recipe site generator.
Create, edit and organize your cooking recipes in flat files via command line. Publish them to a web server, generate markdown files or create you own templates to generate any format you want.
Check out the demo page.
Simple flat file recipe format
Tagging
Adjust servings dynamically (HTML template)
Multi-language support for included templates
To install this application you need an installation of Rust and run:
cargo install sweet-potator
Display config directory location:
sweet-potator info
On *nix systems this should be:
~/.config/sweet-potator
The folder will be created upon first use. It includes the following data:
config.toml
: main configuration filedefault.recipe
: default recipe file to use for new recipesrecipes
: recipe directory (includes all recipe files and images)templates
: template directory (includes the content generation templates)Your favorite editor to use to edit recipe files is probably the first thing you want to configure.
Create a new recipe:
sweet-potator new
Build recipe HTML page:
sweet-potator build <output-directory>
For more options check out the CLI help:
# Show help
sweet-potator help
# Show help of a subcommand (`new`, `list`, etc.)
sweet-potator help <subcommand>
Note: sweet-potator
respects the environment variables FORCE_COLOR
and NO_COLOR
.
A recipe file looks like this:
title
Yield: 1
Time: 30m
Author: name
Tags: tag1, tag2
Ingredients
- name, kind: 1 unit (note)
Instructions
- instruction
Notes
- note
First line: recipe title
Second block: metadata
Yield
: e.g. 4
or 1 Cake
Time
: e.g. 30m
, 1h
or 1h 30m
Author
| Book
| Link
(recipe source):
Author
: name of the recipe authorBook
: name of a bookLink
: e.g. link name > https://example.com
Tags
: list of tags separated by ",
" (comma + space)Third block: ingredient list. kind
, unit
and note
are optional. The quantity number can either be a number (e.g. 2
or 0.5
) or a fraction (e.g. 1/4
)
Forth block: list of plain text recipe instructions
Forth block: list of plain text additional notes
A search function is not included, but there are still ways to search through your recipes.
Search through a generated HTML page is as simple as using your browsers search option.
Search through your recipes via CLI gets a little tricky, but I find it very satisfying. I am using skim for it, because I am into Rust tools, but there is at least fzf that has some pretty similar functionality. Those tools are super helpful in general for many reasons!
When using skim
you can search through your recipes with the following commands:
# Search and edit:
FORCE_COLOR=1 sweet-potator list | sk --ansi | xargs -I{} sweet-potator edit {}
# Search and delete:
FORCE_COLOR=1 sweet-potator list | sk --ansi | xargs -I{} sweet-potator delete {}
You might want to create aliases for those commands (e.g. edit-recipe
and delete-recipe
).
CLI search example using skim:
The included templates (html
and markdown
) have multi-language support. Included languages are English (en
) and German (de
). You can configure which language to use in the template sections of the config file.
Within the included templates (see configuration) is a folder lang
. It includes language files in TOML format. Just copy one and translate it to your language. If you do so, do not forget to share it.
This is mostly meant for future me, but if anyone else is interested, check out the minimalistic markdown example:
cargo run --example markdown