readwiseio / obsidian-readwise

Official Readwise plugin for Obsidian
GNU General Public License v3.0
239 stars 23 forks source link

The '@' should be not part of the author variable in file names #52

Open titusio opened 9 months ago

titusio commented 9 months ago

My export looks something like this: image

The import fails because the '@' character is not allowed for naming files. This results in this error message:

Bildschirmfoto 2023-09-28 um 15 06 13

It would be really helpful if the '@' character would just be removed.

matayaaa commented 6 months ago

this! How to exclude ALL syntax that will mess up obsidian sync??

0xDezzy commented 5 months ago

For those trying to solve this, go to the customize section by clicking the button in the extension settings then in the yaml frontmatter change {{author}} to {{author|replace("@","")}}

tyler-dot-earth commented 3 weeks ago

Hello! Contributor to the plugin here. Sanitization is an issue with the export functionality itself (readwise's backend), not the plugin. I've reported it to them in a formal bug report - I'd encourage you to also do the same. You can submit a formal bug report in Reader.

That said, here's my own exports configuration for filename and front matter santization. You'll wanna use these snippets on the export preferences page.

File name config

{{ title|replace('@', '')|replace('#', 'no.')|replace('^', '')|replace('[', '(')|replace(']', ')')|replace('^', '')|replace(': ', ' - ')|replace(' | ', ' - ')  }}

^ note that there's a few opinionated replacements in there. I explain them here.

YAML Front matter (note that @ is allowed in frontmatter if you quote it)

aliases:
  - "{{title}}"
{% if author %}author: "{{author}}"{% endif %}
{% if document_tags %}related to: {% for tag in document_tags %}
  - "[[{{tag}}]]"{% endfor %}{% endif %}
tags:
  - artifact/readwise{% if category %}/{{category}}{{ "📚" if category == "books"}}{{"📰" if category == "articles"}}{{"🐦" if category == "tweets"}}{{"🎙" if category == "podcasts"}}{% endif %}

@0xDezzy worth noting that you can just use quotes around it like "{{ author }}" in frontmatter instead of replacing it.