How to setup Markdown Mode for Emacs.

Follow these simple steps to install the markdown mode for your emacs.

  • First of all, if you dont have Emacs, get it from here for mac GUI (default for terminal), windows and for linux and you will also have it default in terminal.

  • Get the Markdown package by Json Blevins for emacs and read the instruction of how to use the customization of the mode.

  • Extract the package and place it at ~./.emacs.d/ or at default path (if you are aware of it) to place your modules. For Windows put them under C:\

  • Create a .emacs file in your home folder ~/ (for windows C:\)

  • Add the following lines to the .emacs file. This helps to setup the markdown mode.

    Here make a note that I’m using the extension .md to tell the plugin to treat all the files ending with .md as markdown files. If you want, you can use any extension you prefer.

  • Get the markdown parser script or if you like to use some enhanced features of markdown, get multi-markdown

If you have downloaded the multi-markdown installer, the scripts will be installed at /usr/local/bin/multimarkdown. Or if you cant find where it is located, open your Terminal and type this command

$ which multimarkdown

You will get the path and note it somewhere.

  • Reload the settings by the command M-x load-file ~/.emacs. This command will load the new settings.

  • Open a new markdown file C-x C-f test.md. Tada. you will find the mode to be (Markdown).

So far so good, you now need to configure the plugin to use the appropraite markdown script to convert the markdown code to XHTML.

  • Type M-x customize-mode to open the customization settings for the Markdown Mode. You should be in the same mode when you type the command.

  • The first customization option is to put your version of markdown program. Since you have already noted the path, put the path into it.

Markdown Command

  • Second, the option markdown-command-needs-filename , keep this ‘nil’, as your purpose of setting this mode is to feed the content from your editor to the markdown program.

Markdown Buffer / Filename Settings

  • Save your settings by click on Set for Current Session, then Save for future session and then Exit

Emacs Customization settings save

If you have done with all these settings, you are good to go. And if you are lazy to work with emacs or do all these settings, you can grab GUI live editors like MarkdownLive for mac or MarkdownPad for Windows. Or if you need more choice, here it is.