DominikPieper / obsidian-ReadItLater

MIT License
450 stars 35 forks source link

Remove illegal chars from properties #153

Closed Nitero closed 1 week ago

Nitero commented 5 months ago

Please check that this issue hasn't been reported before.

Expected Behavior

Inserting a youtube title as string into a property should work

Current behaviour

When saving a youtube video where the title includes illegal characters like " and writing this title to a property like below will result in a YAML error which breaks the properties. This can be prevented by not putting the title in quotes, but I think this is suboptimal because then it is is not clear that this property should be treated as a string.

image

Steps to reproduce

Have this as your youtube template and try to save this video.

---
titleAsString: "%videoTitle%"
titleNoString: %videoTitle%
---

Which Operating Systems are you using?

Obsidian Version

1.6.3

Plugin Version

0.4.0

Checks

Possible solution

It seems to work for the file name so maybe just reuse that logic for all properties? Or are there different illegal characters for YAML than for the file name?

Medullitus commented 3 months ago

+++

adamluckdev commented 1 week ago

Please update to the newest version with the new template engine. Then you can use this syntax to replace quotes in the Youtube video title.

---
titleAsString: "{{ videoTitle|replace('"') }}"
---
Medullitus commented 1 week ago

Please update to the newest version with the new template engine. Then you can use this syntax to replace quotes in the Youtube video title.

---
titleAsString: "{{ videoTitle|replace('"') }}"
---

Hello. Thank you for your response. Could you explain how we can apply the syntax you shared?

adamluckdev commented 1 week ago

Please update to the newest version with the new template engine. Then you can use this syntax to replace quotes in the Youtube video title.

---
titleAsString: "{{ videoTitle|replace('"') }}"
---

Hello. Thank you for your response. Could you explain how we can apply the syntax you shared?

Hi, just add it to the selected template in plugin settings. If you have problem with the syntax, please open new issue.