Pulling Metadata into RTF document

Thanks for the tip. Just tested, this Smart Rule also works in Markdown.
Is it possible to search within the yaml-frontmatter of Markdown? For me it only works outside. I have enabled IndexRawMarkdownSource in the hidden preferences.
And a second question: I can change the custom metadata. Can I change the Finder Comments as well?

And a second question: I can change the custom metadata. Can I change the Finder Comments as well?

Yes, as Finder Comments are just text.

Is it possible to search within the yaml-frontmatter of Markdown? For me it only works outside. I have enabled IndexRawMarkdownSource in the hidden preferences.

Yes it should be possible. I too am seeing some issues with Markdown metadata not working in a smart rule. @cgrunenberg would have to look at that. I’m on Ventura at the moment.

Modifying the document so there is no metadata…


…but matched too much since I didn’t add an Option-Return in the Scan Text field.

Adding that yielded this…

And for completeness…

1 Like

Thank you for your reply. For me that smart rule significantly increases the usefulness of custom metadata.

Is there a data field to write the Finder Comments in the Smart Rules or should I use an Apple Script, something that writes to xattr com.apple.metadata:kMDItemFinderComment …

For the time being I would write the custom metadata outside of Yaml. If it works with yaml, I can easily change it.

Sonoma 14.4.1

The hidden preference does not affect scanning, the visible text (not including the metadata) is scanned.

You’re welcome.

Is there a data field to write the Finder Comments in the Smart Rules or should I use an Apple Script, something that writes to xattr com.apple.metadata:kMDItemFinderComment …

There is no need to write directly to xattr and yes, there is a Change Comment smart rule action.
Here is an example that shows preservation of any existing Finder Comment, a linebreak placeholder, and the Document String placeholder…

For the time being I would write the custom metadata outside of Yaml. If it works with yaml, I can easily change it.

Do you actually need to use YAML? MultiMarkdown metadata is supported in DEVONthink.

1 Like

Do you actually need to use YAML? MultiMarkdown metadata is supported in DEVONthink.

It would be more elegant (no need for the two lines!) to be able to do without yaml. I use it just for compatibility with other Markdown programmes. I could reduce the yaml block to the essentials (title, comment, keywords), followed by optional tags populated by smart rules to custom metadata.
I think I’ll have to try it out and see if I can do without yaml.

Standard MultiMarkdown metadata just has to begin as the top line, like the example shown above called MMD.md.

I could even add a hidden section like this, which is not visible in Devonthink (Preview).

[**Custom Metadata**]::
Company: DEVONtech 

I could even add a hidden section like this, which is not visible in Devonthink (Preview).

I supposed you could but MultiMarkdown metadata already is not displayed.

There are only a few markdown apps like iA Writer, nb (terminal note taking) or Pandoc that like yaml. At the moment I’m sticking with yaml plus separate custom tags and test if I don’t care about the other apps.
The good thing is that the smart rules work in any case.

Is it possible to search for dates and assign them to a custom date field? There doesn’t seem to be an option to pass a date, which was found with regex.

No, it is currently not possible to do this with custom metadata having a Date data type. This would require using an Apply Script action and scripting something.

No problem. I have now changed it to a text field. That’s ok.
But why doesn’t it take over the search result here?

Please provide more information when reporting issues. There is nothing in your screen capture indicating there is an issue. In fact, I’d guess your regular expression isn’t returning what you think it should. I would add a Display Alert as the second action and pass \1 to it. Then I would run the rule and see if it’s actually returning anything.

You’re right, of course.
This Regex finally worked: birthday:\ ([0-9]{4}-[0-9]{2}-[0-9]{2})
Thank you!

You’re welcome.
I would suggest you get in the habit of using a Display Alert or something like Change Comment to validate regex captures first. When you see they’re working, then apply them in subsequent actions in the chain.

2 Likes

Not yet but it’s in the pipeline.

2 Likes