Skip to content

Commit

Permalink
Release v0.19.0
Browse files Browse the repository at this point in the history
Added Save Image option  (#22)

* added saveImgOption

* saveImg support

* Changed SaveImg default + added info in readme

Some changes (#25)

* Tags are expected to be an array

As pointed out in an issue in obsidian-recipe-view
lachholden/obsidian-recipe-view#16 (comment)

* Added handlebar function for tags

Added a custom handlebar function to split comma separated strings
into a list for use with Obsidian tags property.

* Updated image grabbing

Fixed speces breaking image links.
Updated image grabber to grab images from instructions.
Added option to store images in subdirectories named after recipe.

* prettyTime handlebar

Added handlebar to prettify time

* Fix image numbering

* Check for local images

Use local images if they exists, instead of attempting to overwrite

* Ability to make a timestamp on save

Through adding the handlebar `savedAt`

* Fix null value bug

* Added magicTime, replacing prettyTime and savedAt

add ci cleanup (#26)

* add ci cleanup

* bug fixes from review

* Reordered checks in magicTime for readability

---------

Co-authored-by: lanjelin <6988319+Lanjelin@users.noreply.github.com>
  • Loading branch information
seethroughdev and Lanjelin committed May 3, 2024
1 parent 5b47201 commit 330823b
Show file tree
Hide file tree
Showing 12 changed files with 807 additions and 171 deletions.
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ https://github.com/seethroughdev/obsidian-recipe-grabber/assets/203779/88e3977c-
The frontmatter has to start on the first line of the file now. If you have leading newlines in your recipe template, the resulting frontmatter won't be properly parsed by obsidian.
If you have this problem, go to the settings of this plugin and remove the leading newlines.

### Settings

- Save Image: Downloads the recipe image into the vault (save location can be set in the plugin settings). `{{image}}` value will be the link to the downloaded file instead of the direct URL. Disabled by default. If Save Image option is enabled, use `![[{{image}}]]` in the template.
> if settings is toggled off or image save fails, `{{image}}` value will be a direct URL.
### Custom templating

Prefer your own layout instead? No problem. Just paste a [custom handlebars string template](https://handlebarsjs.com/guide/#simple-expressions) into the settings.
Expand All @@ -20,4 +25,41 @@ We're assuming the page has a [json recipe](https://developers.google.com/search

You can also add `{{{json}}}` for the raw json in the template if you like.

#### Custom handlebar functions

`splitTags`
Split comma separated tags. Obsidian expect tags as a list in its properties.

```
tags:
{{splitTags keywords}}
```

`magicTime`
Attempts to handle anything included with time and date.
Change the ugly PT1H30M string to a prettier 1h 30min formatting.
Insert or reformat existing timestamps using any masks available at [dateformat](https://www.npmjs.com/package/dateformat), defaults to `yyyy-mm-dd HH:MM`.

```
DateSaved: {{magicTime}}
DateSaved2: {{magicTime "dd-mm-yyyy HH:MM"}}
CookTime: {{magicTime cookTime}}
TotalTime: {{magicTime totalTime}}
DatePublished1: {{magicTime datePublished}}
DatePublished2: {{magicTime datePublished "dd-mm-yyyy HH:MM"}}
```

Would return something like

```
DateSaved: 2024-04-13 20:10
DateSaved2: 13-04-2024 20:10
CookTime: 15m
TotalTime: 1h 5m
DatePublished1: 2017-07-27 00:14
DatePublished2: 27-07-2017 00:14
```

---

In the meantime, I did my best to make the most recipes I can work out of the box. Please [create ticket](#) if you have suggestions for improving it!
1 change: 1 addition & 0 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const context = await esbuild.context({
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
platform: "node",
outfile: "main.js",
});

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "recipe-grabber",
"name": "Recipe Grabber",
"version": "0.18.0",
"version": "0.19.0",
"minAppVersion": "0.15.0",
"description": "Quickly grab the important contents of any online recipe.",
"author": "seethroughdev",
Expand Down
Loading

0 comments on commit 330823b

Please sign in to comment.