Closed BBazard closed 8 months ago
OK. Seems doable. The easiest approach is to implement a _MSGRECIPIENTSLIST that gives the same data as _MSGRECIPENTS (and similar _MSGCCLIST and _MSGBCCLIST placeholders when I implement that issue too) but with the data formatted as a list.
I think this would serve your needs. Would you agree with that assessment?
Yes, sounds good.
To be yaml compatible that would also be good to escape quotes, otherwise obsidian cannot parse the frontmatter.
"Kevin N. Haw" <notifications@github.com>
becomes
"\"Kevin N. Haw\" <notifications@github.com>"
Good. I'm chewing on it but am concerned about a few things from my original idea.
First, what happens in YAML if the properties are empty? For example, imagine a message with no one CC'd:
Recipients:
- "\"Kevin N. Haw\" <notifications@github.com>"
- "\"Bill Gates\" <bill@microsoft.com>"
CC:
BCC:
- "\"Sen. Elizabeth Warren\" <senwarren@senate.gov>"
Will YAML understand that there is nothing in the CC field or does it confuse it with BCC? If it can't handle that then I need way to not print "CC" here. That requires interaction between user content and message content, which I haven't done yet and adds more complexity. I can try it out myself but if you already know please enlighten me.
Second, your comment about escaping quotes is making me wonder about other syntactic pitfalls here. I'll do some searching but offhand do you know of a formal definition of the YAML syntax? I want to have every contingency handled in my code and have test cases to exercise it when I try this.
As always, thanks for using ObsidianClipper! I'm so happy it's useful to people.
Nice thinking for the missing value edge case. After tests, I see that if a property is empty, obsidian just displays Empty
, no special handling required.
Looking at some spec I see that Double-Quoted Style is the only style capable of expressing arbitrary strings: https://yaml.org/spec/1.2.2/#731-double-quoted-style
So the easiest way would be to just surround the string with "
and escape "
and \
Examples:
string
-> "string"
"string"
-> "\"string\""
\u0040 is '@'
-> "\\u0040 is '@'"
It is admittedly less readable than just plain style. But since obsidian pretty-print the properties in live preview, I think it's good enough to convert everything to double quoted style.
PS: not sure how you test the obsidian properties, but I personally use the Toggle Live Preview/Source mode
from the command palette.
OK. I just submitted v0.3.2 for approval with this and Issue #14 implemented. It should be pushed to users next week. I will close out this issue when it's live.
v0.3.2 is out so I'm going to close this issue. Please reopen or create a new issue if there are problems.
Thanks for using ObsidianClipper!
Fantastic clipper, thank you! I think it would be great to make more use of the obsidian properties / frontmatter. I am using
Now I would like to use a list property type for the field To (and Cc/Bc if they are added). Which requires to change the formatting to be yaml compatible
becomes