Marked and Bear
Recent releases of Marked have fixed Bear compatibility on Sonoma. As part of this, I’ve updated the Bear style for Marked, and written a little custom preprocessor to handle Bear’s (CommonMark) syntax properly. If you want a Marked preview styled to look exactly like Bear (with all of Marked’s options for export, navigation, and other features), you can use the Bear style in combination with the preprocessor, but if you just want Bear’s syntax properly interpreted, you can use the preprocessor with the style of your choosing1.
To get the Bear style, go the the Style Gallery and open the Bear style. Click “Install” to add it to Marked in one click.
For the custom preprocessor to work, you’ll need Ruby available on your system. As far as I know, Ruby is still distributed with macOS (for now), and if you open Terminal and run
which ruby
, you should get a path back, e.g./usr/bin/ruby
. If this isn’t the case for you and you need further help, please post on the support forum and I’ll update the instructions as needed.
For handling Bear’s specific syntax, like [[links]]
, underlining, and strikethrough, you’ll need a custom preprocessor. Save the following to a file called bear-preprocessor.rb
in a safe folder (one you won’t move in the future).
Updated: now handles making tags clickable as well, and no longer requires that the #Text is tag
preference be set in Marked.
Updated: now handles links with titles ([[link|title]]
) and links with headers ([[link/header]]
).
Open terminal and run chmod a+x /path/to/file/bear-preprocessor.rb
. That will make it executable, then you can just add /path/to/file/bear-preprocessor.rb
as your custom preprocessor path in Marked->Advanced preferences. (To get the absolute path for a file, right click it in Finder, hold down Option, and click ‘Copy “bear-preprocess.rb” as Pathname’. That will put the absolute path to the file in your clipboard, which you can paste for both the chmod
command and the Custom Preprocessor field.)
This script will convert [[wiki links]]
into Bear internal links, which will open linked notes in Bear when clicked, and handle special cases like ~~strikethrough~~
, ~underline~
, and ==highlighting==
.
In addition, you’ll want to set your Processor to MultiMarkdown and enable “#Text is tag” and the sub-item “Style tags” in Preferences->Processor. Note that the New script above handles #tags and makes them clickable.#tag
processing will only work if you’re not using a custom processor (custom preprocessor like above won’t override it).
If you need additional help setting this up, just ping me on http://support.markedapp.com.
If you’re using a non-Bear Style and want underlines formatted, you can modify a custom Style or add the following to Marked->Preferences->Style->Additional CSS and modify as desired:
.underline {
border-bottom: 1px solid rgb(222, 84, 86);;
}
I might eventually add support for Bear (CommonMark) syntax directly to Marked, but the whole purpose of the preprocessor functionality was to handle cases like this, and linking to Bear documents internally should be a case-by-case decision. The same part of the custom preprocessor that handles [[links]]
could be repurposed for any system that allows internal [[linking]]
and has a url handler syntax (like nvUltra, which I’ll post a preprocessor for when it’s available2, or Obsidian). You can also always set up CommonMark as a custom processor to get full compatibility.