I’ve used Ulysses writing environment for months and I’ve come to really like the experience. It’s stable and nicely designed, iCloud implementation is great and it even allows adding external folders to work with (although integration with their database is not perfect).

Ulysses may represent the perfect environment for most writers: pure text, pseudo markdown, clean interface and a distraction-free layout. However, I think I feel more comfortable writing on an App that closely represents what the final product is going to look like. In looking for alternatives, I tried several Apps and workflows, but none seemed to work for me… until I came across Bear App. Once I tried it out for a couple of days, I couldn’t look back:

Bear App in a Nutshell

Advantages

  • Beautiful typography and clean, almost perfect in-line preview (here is an alternative offering of what I would consider the perfect preview experience).
  • Fast and responsive.
  • Flexible use of tags.
  • Image previews.
  • Code previews.
  • Excellent keyboard submenu on iOS Apps.
  • Free apps for both Mac and iOS. If you want to be able to sync between them and more export options, you’ll need a subscription (genius!). The subscription model is flexible and reasonably priced.

Shortcomings

  • Limited control over how images are handled (image name, image title, etc.).
  • No option for importing documents from Dropbox (although that can be remedied with a Workflow).
  • Attachments are not exported on iOS (for now ?).
  • No options for exporting to site generators like Pelican.
  • No advanced filters or way to save searches.

Exporting from Bear to Pelican

My original idea was to put together a process to export documents (i.e. blog posts) from Bear for both Mac and iOS to Pelican. Something similar to what I did for Ulysses. However, at the time of writing, Bear for iOS doesn’t include attachments when exporting to Markdown (hopefully, this will be addressed soon by the Bear team). Therefore, this post is limited to exporting documents from the Mac App to Pelican (I’ll update it if/when the iOS App is fixed).

I wanted to keep things simple, so the whole export process can be summarized in the following three steps:

  1. Export Bear document to markdown including attachments and leaving tags out.
  2. Compress the exported files into a zip file: select them, right click and select Compress Items on a Mac.
  3. Run the Python Script with the zip file as an argument. One way of quickly doing this is through Alfred App and a Workflow I’ve put together (see the Resources section). Just update the Workflow Environment Variables section with the path to the Python script.

Workflow Environment Variables in workflow settings.
Workflow Environment Variables in workflow settings.

Then, select the zip file on finder, hit the key combination for grabbing files in Alfred, select the workflow and hit enter.

Script Notes

  • Folder configuration is done in the first lines of the script. Make sure folder paths are edited to suit your needs.
# Constant Definition
# -------------------

# Path to be prepended to image links in markdown file, like so: ![](IMAGE_LINK<image_filename>).
IMAGE_LNK = '/images/'

# Pelican Content Folders:
POSTS_FOLDER = 'YOUR PELICAN POST FOLDER PATH'
IMAGES_FOLDER = 'YOUR PELICAN IMAGE FOLDER PATH'
FILES_FOLDER = 'YOUR PELICAN FILES FOLDER PATH'
# -------------------
  • Right now, Bear doesn’t support assigning Titles or Alt Text to images in any of the Apps (i.e. Mac or iOS). In order to work around that, the script will take any text within the keys < and > and assign it to the image’s Title and Alt Text as long as the block <Image Title> is placed right next to the image (i.e. not on a separate line) on the Bear document.
  • The script removes the Bear document title (the first line with # Title at the top of the note) so that the Pelican header is at the top of the exported markdown file. See below.

Screenshot from Bear App for iOS. “H1” line is removed by the script.
Screenshot from Bear App for iOS. “H1” line is removed by the script.

If the first line is not removed to allow the header to be at the top, Pelican would not process the document when generating the web site.

Resources

Here are the resources referenced in the lines above: