How can I get Obsidian to recognize "..." as terminating YAML frontmatter?

What I’m trying to do

I’m interested in migrating my markdown notes to an obsidian vault. My markdown notes use YAML frontmatter to store metadata. The YAML specification defines two ways of terminating a document: --- and .... The YAML frontmatter in my markdown notes is terminated with ..., but this is not recognized by Obsidian, which instead treats the whole markdown note as unterminated YAML frontmatter.

Things I have tried

I’ve tried replacing the terminal ... in the YAML frontmatter of one markdown notes with ---. This enables obsidian to parse the frontmatter correctly. However, it isn’t practical for me to edit my tens of thousands of markdown notes to change all the YAML terminators.

Does obsidian have a setting to enable correct parsing of YAML?

You need to try maybe Linter plugin (not sure if it will help with this).

Otherwise it is easiest to do search and replace in VSCode, Notepad++ or maybe Sublime Text (this doesn’t save the results to the files straight away).
In order to make sure only YAML frontmatter parts are changed, you’d best do regular expression substitutions.

match: (^\.\.\.$)
replace: ---

Explanation: ^ looks for line-openers; \. means dot, otherwise in regex . means any character so it must be escaped; $ means the matches always end the line, so if you have sentences like ...But I know what I'm doing., they won’t be affected.
I added a capture group () for good measure.

As always have a backup before you search and replace with regex.
Don’t forget to use Find in Files to do search and replace for all files/your vault and to tick the regex box in Notepad++ or any other program you are using.


Thanks for the tips!

I looked up the Linter plugin and it looks nice for future use, but I couldn’t find an appropriate feature there to help with this issue.

In the end I wrote an awk script to try and be safe, less impractical than I thought, something like…


NR==1 && /^---$/ {
    yamlStarted=1; yamlNotDotted=1; yamlAbsent=0

yamlAbsent {
    print; next

yamlStarted && yamlNotDotted && /^\.\.\.$/ {
    yamlNotDotted=0; print "---"; next


The results look ok and I don’t think anything got broken so far :crossed_fingers: but I have a backup just in case!

I still wonder why obsidian doesn’t comply with that part of the yaml specification though? Is there a particular reason?

Well, I can’t say anything other than, Banzai!
You were pretty nifty right there, sir.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.