Paprika Recipes > Obsidian > Dataview recipe manager

I’ve been looking for a while at moving my recipe database out of Paprika Recipe Manager. After trying out a bunch of different self-hosted options like Tandoor, I didn’t find anything I really liked, so was stuck still using it. That was, until I migrated my md notes recently to Obsidian and stumbled upon this cool thread with some really nice ideas and DataView demos.

I decided to write a script to move my recipes into Markdown. I’ve uploaded the results to a GitHub repo with a fairly decent set of instructions on how to use it.

You can choose and edit the templates and make your recipes into whatever you want them to be. It should also be fairly straightforward to program this for other recipe managers as well. I’ve also included a plain markdown template and a YML only template if folks don’t want to use Dataview/Obsidian.

I hope other recipe/cooking tech fans can help create an even better Markdown recipe manager using just YML frontmatter and Dataview/DataviewJS. It’s already looking pretty good, but it could be even better/more useful.

Eventually I’d like to be able to import recipes from a page into a Markdown note, without the use of Paprika.

It’ll work pretty much out of the box and supports recipe scaling and hiding empty elements.

Rendered markdown:

YML:

Dataview Code:

9 Likes

2 next big tasks are:

  • [ ] Get a column view working with the DataviewJS to make the view a bit less linear
  • [ ] Get some nice Dataviews set up to add to the demo vault.

Any advice, suggestions on either of those would be super welcome!

Your github repo link points back to the forum post here.

Doh, shucks that’s not a good start. Here is the CORRECT GITHUB LINK. Couldn’t see a way to edit the original post unfortunately.

If any admins have more permissions and can update the original post, I’d be more than happy, no problem if not!

yep, your link is updated now

1 Like

I just wanted to give a huge thank you for creating this repo. I have all my recipes currently in Paprika and thought it would be really interesting to Obsidian-ize them. Lo and behold, someone else beat me to it!

This looks super interesting… I was in the process of thinking of rewriting some of my recipes in cooklang maybe this is a better way of doing it.

Good to hear @Quinn_McHugh and @kmf! Hadn’t had any response on this and just assumed it was a bit too niche for folks to want to use!

@kmf I did have a look into cooklang and while I think it’s a really interesting project, the thought of manually converting all my 600+ recipes wasn’t really appealing. As the ingredient conversion is still fairly simplistic as I didn’t have time to look into the AI option. You’ll have to go through and check the ingredients in each recipe, but this is optional, the conversions will still work without it, just there’ll be less scaling functionality. I found about 1/4 of the recipes needed some tweaking, and I’m now in the habit of doing that when I add a recipe to Paprika.

I have added a button to the template file which allows you to edit the metadata but honestly it’s not much more work (or complexity) to just edit the metadata. The functionality requires the MetaEdit and Buttons plugins. I may update the templates at some point.

This is the code:

name Edit Recipe
type command
action MetaEdit: Run MetaEdit
id EditMetaData

And if anybody has any suggestions/improvements I’m happy to hear them here or as GitHub issues. Cheers!

jt196 this looks great. I’ve 833 recipes in Paprika that I’ve been wanting to migrate to Obsidian and the only way I had was manual cut and paste, which I’d never have time for, so thank you!

I’ve been playing with this for a lot of today and it’s not quite ready for me to move everything over to Obsidian. I’ve identified what I think are some of the issues, but I know nothing about Python so may be mistaken, but I did have my son weigh in and he knows some Python.

  1. The script stopped whenever it encountered a recipe that didn’t have a photo attached in Paprika. My son changed the script to fix this. Let me know if you would like more details.

  2. In parsing the ingredients, directions and notes, the script trips up when it encounters certain characters. The ones I found include what’s typically known as the “Right Double Quotation Mark”. It’s this symbol: ” . They are more curved than the ones generated by my keyboard, when hitting Shift and the key next to Enter: " , which seem to be just called “Quotation Marks”. Replacing these fixes the issue.

Another one looked like the degree symbol, but a little more elongated. A proper degree symbol can be entered using Alt-0176 and replacing again fixes the issue.

  1. Some of my recipes had a forward slash within the recipe name, in cases where there was more than one name typically used for the recipe. Obviously forward slashes aren’t going to work within a file name, so I replaced these with “or”.

I hope this helps if you want to develop this plugin further and I hope that you do.

1 Like

The output from this script is really impressive! It also is very Obsidian focused and complicated. I wanted something simpler - just straight up markdown with a little bit of frontmatter.

My project for this is here: GitHub - yipmarvel/paprika-to-markdown: Converts a paprika recipe export file to markdown files with images

I do not know if it addresses all of johnkitchen’s issues but it definitely works fine if a recipe does not have a photo.

Sharing in case useful to johnkitchen or others looking for this in the future.

3 Likes

Ech sorry, not on here a ton otherwise would have answered a bit earlier. You can actually choose a simple MD template in the script.

python paprika_to_md.py "Archive.paprikarecipes" "my_vault/recipes" "_resources" "template_puremd.md"

Just head to the template folder and amend the template to however you wish.

I’ve got to put some try-catch blocks in for the points @johnkitchen raised, but just haven’t got round to it. I’ll make sure I do in the next few weeks.

1 Like

You can make your own template however you want, just amend the template format to your own style. Combining the yml and md template for example:

---
name: $recipe_name
source: $recipe_source
ingredients: $recipe_ingredients
source: $recipe_source
difficulty: $recipe_difficulty
photo_thumbnail: $recipe_photo
image_url: $recipe_image_url
total_time: $recipe_total_time
notes: |$recipe_notes
nutritional_info: $recipe_nutritional_info
description: |$recipe_description
rating: $recipe_rating
prep_time: $recipe_prep_time
created: $recipe_created
directions: |$recipe_directions
categories: $recipe_categories
source_url: $recipe_source_url
cook_time: $recipe_cook_time
servings: $recipe_servings
scale: $recipe_scale
tags: $recipe_tags
photos: $photo_list
authors: |$my_authors
---
# name: $recipe_name

## source: $recipe_source

## ingredients: $recipe_ingredients

### source: $recipe_source
### difficulty: $recipe_difficulty
### prep_time: $recipe_prep_time

#### servings: $recipe_servings
#### total_time: $recipe_total_time
#### cook_time: $recipe_cook_time
#### scale: $recipe_scale
#### tags: $recipe_tags

authors: |$my_authors
photo_thumbnail: ![Thumbnail]($recipe_photo)
photos: $photo_list
image_url: $recipe_image_url
source_url: $recipe_source_url
rating: $recipe_rating
created: $recipe_created
categories: $recipe_categories


# Description:

$recipe_description

# Directions:

$recipe_directions

# Notes: 

$recipe_notes

# Nutrition: 

$recipe_nutritional_info

Just save the file in the template folder and reference it on the command line.

Hey @jt196, I haven’t yet gotten a chance to test your script yet, but just wanted to explain my use case:

I’d like to use Obsidian to document knowledge about different cooking ingredients (e.g. best practices for ingredient storage, cooking tips, great flavor pairings, etc).

Each ingredient would have its own dedicated markdown file and using your script (likely with modifications), each recipe would be one-way synced from Paprika into individual markdown files. Then, by configuring the template you’ve provided, I could automatically link the ingredients listed in each recipe markdown file to its associated ingredient markdown file, providing an easy way to reference and update information about the ingredients I’m using while cooking.

The ultimate goal of this would be to develop a better understanding of the ingredients I use in my everyday cooking, such that I don’t have to be nearly as reliant on recipes to make great-tasting food.

Quinn, thanks for taking the time to update and fix the script. I was thinking about generating some ingredient files - I think there was some talk about this elsewhere on the forum in a thread about recipes, maybe that was programatically via Dataview?

I’m looking at doing exactly the same thing (Obsidian-izing my recipes would solve a couple problems I haven’t been able to solve with actual recipe software – namely, it’s not future-proof, and nothing works on both Windows and Linux).

When you use this script to export, does it know to pull in the recipe images?

As to functionality, I think I’m going to use the native Obsidian features to do most of what I’d really like to be able to do, but I’d love to see a recipe plugin that would format the display accordingly – and maybe have a way to browse them more visually. But it may be there are existing Obsidian plugins for other purposes that will do that.

Not being a programmer, I’m having a little trouble getting Python to run on Windows. Am trying to get help from some programmer friends and will update.

I have an additional follow-up question, though. The resultant notes should still work in Obsidian without dataview, right? Just some of the functionality (like scaling) will be lost?

Something didn’t work. I don’t think this was user error. (I wasn’t 100% sure if the filenames were literally supposed to be enclosed in quotes, but it looks like it found them, so I assume yes. And it looks like what it had a problem with was parsing the database.)

FOR USERS:
I’m on Windows, and the hardest part for me was installing Python. LOL For newbies like me, make sure you tick the PATH checkbox during installation. Then you can enter “cmd” into the Windows search bar to open a command line. “cd directoryname” (where directoryname is whatever your folder is called) will navigate you to the “repo folder,” as the GitHub instructions call it, so you can proceed.

FOR THE DEVELOPER:
I’m not sure what went wrong, but it did try to run and it didn’t actually (as far as I can tell) output anything. (The only thing that’s in that folder is what was in the folder before.)

I’m not sure where to go from here.

UPDATE:

Me again; sorry. I’m using Quinn’s update now – not sure if that’s what fixed the original glitch or not. I have a very large recipe database (13,165 recipes) and it’s running into issues with recipe titles that contain a pipe (|), a question mark (?), asterisk ( * ), or a colon ( : ). That I can tell so far.

If it hits one of these it throws up an error and stops the script. That’s mostly an FYI. I just have been changing the recipe title and rerunning it. (This is actually quicker than scrolling through 13,000 recipes :laughing: )

However…it’s giving me an “error parsing ingredients” for every recipe. This is what actually gets output in the final file if using the plain MD template:

So I’m not sure exactly what it’s doing/not doing, script-wise. I’m pretty sure this is not what’s supposed to be displaying. It looks like this is both the actual intended display output and a unit-based version that would be used for calculations. (Although this is what the output looks like with the plain MD template, the ingredient-parsing error is happening regardless of which template I use.)

UPDATE #2:

I still haven’t sorted out what the ingredient-parsing error is and am not sure if the output is what it’s supposed to be doing or not. But I also discovered that it can’t handle recipes that have the same title. This is a problem, because they aren’t necessarily the same. So if you have, say, “Peanut Butter Cookies” and “Peanut Butter Cookies,” it doesn’t keep them both and append a number or something to the second file; it just overwrites it or deletes it or skips it, or…something. I’m not sure what it’s doing to these files, exactly, but they’re missing from the final result.

It would be a lot easier to figure out what’s actually a duplicate and/or rename this after converting the files than have to do it beforehand, since one of the reasons for moving away from Paprika is that it’s so many steps to get “into” a recipe to edit it.