# π Grocy Shopping List Bridge
Send ingredients from your Obsidian recipe notes straight into your [Grocy](https://grocy.info) shopping list.
Works seamlessly with other recipe plugins β supports fuzzy product matching, auto-matching with thresholds, free-text items, and manual overrides.
---
## π Quick Start
1. **Install**: Copy this plugin into `.obsidian/plugins/grocy-shoppinglist-bridge/` and enable it in Obsidian.
2. **Configure**: In plugin settings, set your **Grocy URL** and **API Key**.
3. **Use**: Open a recipe note β click the π ribbon button β ingredients appear in your Grocy shopping list.
---
## β¨ Features
- Parse `## Ingredients` sections automatically (supports nested subheadings like `### Sauce`, `#### Marinade`).
- Smart ingredient normalization:
- `1 large egg` β **eggs**
- `3 cloves garlic (minced)` β **garlic**
- Fuzzy matching against Grocy's products with adjustable confidence.
- Multiple fallback strategies when no match is found.
- Manual overrides via inline annotations (`grocy_id`, `grocy:`).
- Ribbon button + command palette support.
- Works out-of-the-box with [Recipe Grabber](https://github.com/seethroughdev/obsidian-recipe-grabber).
Imported recipes are parsed automatically.
- Plays nicely with [Recipe View](https://obsidian-recipe-view.readthedocs.io/en/latest/).
If you use the **HTML comment syntax** (``), Recipe View will hide the annotation from the rendered card.
---
## π₯ Installation
1. Download the repo.
2. Copy into your vault:
```
.obsidian/plugins/grocy-shoppinglist-bridge/
```
3. Reload community plugins in Obsidian.
4. Enable **Grocy Shopping List Bridge**.
---
## π Usage
### Recipe note example
```markdown
## Ingredients
- 1 large egg
- 3 cloves garlic (minced)
- 1 broccoli crown
### Sauce
- 2 tbsp soy sauce
- 1 tsp sesame oil
## Directions
Mix and cook...
```
- Click the **π ribbon button** or run:
```
Grocy: Add ingredients to shopping list
```
- All bullet points under **Ingredients** (and its subheadings) are added.
- Stops before the next top-level section (e.g. `## Directions`).
---
## βοΈ Settings
| Setting | Description |
|---------|-------------|
| **Grocy URL** | Base URL of your Grocy (e.g. `http://localhost/grocy` or `https://your-domain/grocy`) |
| **API Key** | Create in Grocy β Settings β Manage API keys |
| **Shopping List ID** | Usually `1` unless you have multiple lists |
| **Auto-confirm unique match** | If only one candidate matches, add automatically |
| **Auto-match threshold** | Default `6` β top candidate score required for auto-add |
| **Require score margin** | Default `2` β top candidate must be this many points above runner-up |
| **Debug matching** | Log candidate scores & decisions to Obsidian console |
| **No-match fallback** | What to do when no good product is found:
β’ **Ask** (chooser + free-text option)
β’ **Prompt free-text** (type a note)
β’ **Free-text** (auto-add note)
β’ **Skip** |
---
## ποΈ Forcing Matches (Annotations)
If you want exact control over which Grocy product is used:
### By Grocy ID
```markdown
- 2 tomatoes (grocy_id: 42)
```
Or with an HTML comment (**hidden in Recipe View**):
```markdown
- 2 tomatoes
```
> β οΈ Recipe View will display clean ingredients without showing the `grocy_id` comment, if using the HTML notation.
### By Product Name
```markdown
- 1 chili pepper (grocy: jalapeΓ±o)
```
This forces the matcher to look for βjalapeΓ±oβ specifically.
---
## π Example Workflows
### Fully Automated
- Auto-confirm unique = β
- Threshold = `6`, Margin = `2`
- Fallback = **Free-text**
β Most items auto-add. Unmatched lines go in as notes.
---
### Semi-Automated
- Auto-confirm unique = β
- Fallback = **Ask**
β Confident matches auto-add, ambiguous ones ask you.
---
### Manual Control
- Auto-confirm unique = β
- Fallback = **Ask**
β You confirm every item via chooser.
---
## π Debugging
- Enable **Debug matching** in settings.
- Open **View β Toggle Developer Tools β Console** in Obsidian.
- You'll see logs like:
```
Match: 1 large egg β needle: eggs
top: {id:12, name:"Eggs", score:11}
Auto-matched β Eggs
```