Make spotlight index markdown files

  1. Put a sample word, e.g. "Francis", in the file ~/Downloads/test.md
  2. add the following line to /System/Library/Spotlight/RichText.mdimporter/Contents/Info.plist under <key>LSItemContentTypes</key>
<string>net.daringfireball.markdown</string>

Now execute the following lines in the terminal:

# reload the importer to pick up the line you added
mdimport -r /System/Library/Spotlight/RichText.mdimporter

# force a reindexing
sudo mdutil -E /

# start activity monitor. The md processes, e.g. mds, mdworker etc should consume some processing power as they reindex your files
# try finding the word via fulltext search
mdfind Francis -onlyin Downloads

How I use it for knowledge management

There a a number of good solutions for knowledge management out there. Evernote, mediawiki and confluence are only some of the wide range of tools. I like to use the file system, though, as it enables easy and transparent encryption, easy previews via quicklook, storing larger files, etc.

Therefore, I use boxcryptor to sync my files encrypted to google drive. I enabled spotlight indexing in boxcryptor to be able to use spotlight (or better, alfred) to search these files. In boxcryptor, I have a folder Wiki. In Alfred, I have a workflow to only search this folder via file names and fulltext. So when I fire up alfred and enter "wiki Francis" it finds all files in the Wiki folder containing the word "Francis".