YAML Front Matter

I’m trying to create YANL front matter in Beta 2 and start with — and end with — and have a number of key however I cannot get the editor to recognise the front matter. Anyone else struggling with this?

YAML works fine for me, with a couple caveats:

  1. In macOS you’ve got to disable smart dashes in Bear (which I’m fine with) or figure out a way to get three dashes injected into Bear without them being converted into an em dash
  2. In iOS, you’ve got to disable smart dashes system-wide since you can’t do this on an app-by-app basis (something I’m not willing to do)

Just in case you’re unsure, this is the proper format for YAML in Bear

key1: value1
key2: value2

The big issue with YAML in Bear is in iOS. If you’ve got smart dashes turned on, pretty much whatever you do, any combo of dashes will automatically be converted to an em dash (basically a super long dash). This happens even if you’ve got a Text Replacement set up in Settings.

YAML functionality really needs to be in the Bear keyboard, but until it’s added (or possibly, if it’s added), AFAIK, you’re stuck with copying the YAML from another note and pasting it into the current note.

Another option would be a TextExpander snippet, but this functionality is currently disabled in the iOS beta.

Thank you so much. Yes, conforming I’m using this YAML format. This explains why I’ve been struggling.

Just disable the Smart Punctuation on Keyboard on iOS/ipadOS to start to type the —

Another workaround, until they add YAML block as a shortcut, is:

  1. Make a code block at top of note.
  2. Write your YAML statements there.
  3. Search for backtick Replace All with -
  4. Code block has now become YAML block.

Or even easier: keep a YAML block in a separate note as a template you can copy/paste from, wherever you need it.

Thanks for the tip. This works. I’m also turned off smart punctuation.

Where is this mythical “disable smart dashes” in the current Bear beta on Mac? I don’t see that option anywhere and turning it off in Ventura system settings (smart dashes) didn’t do anything.

In fact none of the options here work on Mac. Code block search and replace ends up turning the “—” into a horizontal rule.

I can mosdef say disabling smart dashes works fine on my system (Ventura).

Sorry I’m out of office and on mobile so I’ve edited this comment to add:

You can disable all “smart” stuff by going to menubar -> edit -> text replacement and deselecting “smart dashes”.

Doesn’t work here on Ventura unfortunately even with the System Settings option turned off AND all of the stuff in the menu turned off. I still get the horizontal rule. Build 10641. Same thing on iOS build. Turning off the smart stuff doesnt allow me to type “- - -” and then hit return. Always converts to a horizontal line (not even an em dash)

Not the end of the world but annoying.

Having the same issue. Markdown converts --- into a horizontal rule. When I add added ``` around the YAML, the horizontal rule turns back into dashes.

As soon as I remove the backticks it turns into a horizontal rule again.

Weird. I think I’ve had smart dashes and quotes disabled globally in macOS (settings -> keyboard i think) since there was an option to do so… wonder if that’s part of it?

I’ve definitely had it disabled in all text editors (including Bear) for years, so since that pref was set in Bear 1 maybe it carried over?

When I’m back in office I’ll investigate further.

Yeah it’s weird. Clearly it is working for some here. Not sure why its not working on my machine(s) hah.

Just checking are you placing the YAML code above the H1 heading?

I turned this off in my MacOS setting not in the Bear app.

YAML front matter block has to start on very first line of note, above title. Otherwise the --- will be displayed as horizontal lines.

Yes it’s a bit confusing:

The YAML block won’t reveal itself as such until you also type the closing triple dashes. (But only if you started the block on very beginning of note!)

Until then the opening triple dashes tag will be displayed as horizontal line.

I think it would be good to get a shortcut button for the YAML block soon …

1 Like

OK so just figured it out tho still not really sure what is going on.

Top of file three dashes hit enter. turns into line.
Type in my text hit enter.
Type three more dashes on next line hit enter and boom. I get a front matter section that is gray like this:


move cursor out and it looks like this:


Also, “smart” settings dont change this behavior at all.

Sorry roar I was typing my stuff as you posted. Yes you are exactly right.

Buenas tardes, espero les ayude este gif para iOS/iPadOS, esta en español :grinning:


Yep but it does not work that way on my iPhone even with smart punctuation turned off :wink: It works exactly like it does on my Mac as I wrote about above.

And frankly I totally get why they do it, because in Markdown three dashes generally denote a horizontal rule unless you’re someone using the weird alternate syntax for header 2.