How I use Sublime Text 2 to work with Markdown
I’ve been using markdown for a while now. I’ve used so many different editors. I’ve read post after post and listend to a ton of podcasts just trying to figure out the best workflow for me. There isn’t much that I need in my opinion. I need to write lab guides, tutorials, and blog posts, all having similar formatting requirements. The big one is the display of code, especially for the lab guides. One thing I like is being able to see what the end result will be. There are four ways I have found to do this:
- Use Mou.
- Use Markdown Pro.
- Use Sublime Text with a Preview in Browser option.
- Use Sublime Text with Marked.
Mou is nice because it has the preview in the same window, it’s live, and when you scroll the text the preview scrolls with it. But of you are working on large documents this can get out of hand quickly.
Markdown Pro is similar to Mou. In my opinion, it looks a little better. But for me the drawbacks are that it doesn’t scroll the preview when you scroll the text. This quickly rules this one out for me.
Sublime Text on the other hand is a little intimidating. But after you figure out what it can do it makes a lot of sense. I’ll admit that moving from one of the previous mentioned to sublime text 2 is a big jump, but i think that its one you will not regret, assuming you put a little time into learning how it works.
Learning the Basics of Sublime Text 2.
There are a few fundamental elements to sumblime text 2 that I recommend you learn. These elements include the following:
- How to install packages
- How to customize the interface
- How to use some of the keyboard shortcuts
- How to work with a project
- Using Marked for Document Preview
These are the elements that were important to me. They greatly improved my workflow and I’m sure you can do the same if you spend a little time learning Sublime Text 2’s interworkings a little bit. So before I cover these points in the way that I use them, I recommend you check out the free training videos on Sublime Text 2, at Tuts+. These videos are fantastic. They are short and to the point. Very beneficial.
How to install packages
There are two ways to install packages, with or without package control. I’m going to talk about installing packages “with” package control. The above mentioned videos cover both. So the first thing you need to do is head over to wbond.net and install the package manager.
Once you have package manager installed it’s time to install the packages that are useful for working with Markdown. For me, those packages include:
Of course there are others, but these got me started. The video below shows how to install these packages.
MarkdownEditing changes the theme and looks a little more mike Byword. If you follow the link and look at the complete feature list you’ll see that there is more that the package does, in addition to just changing the theme. This package adds some nice shortcuts for working with Markdown.
The other editors I mentioned above failed to work well with large projects. Too much text on one page and I was as lost as could be. An editor that I didnt mention that somewhat solves this is FoldingText. This allowed me to fold the headings up so that I could control the document a little better. It still was missing some other elements that I wanted. So when I came across SmartMarkdown I was overjoyed that I could have the folding text capability in Sumblime Text 2. Simply move to a head and hit the tab key and viola!
Markdown Preview partially solves one of my likes, and that’s being able to see what the finished product looks like. With this package you can easily preview your text in a web browser. To do this simply enter cmd + shift + p, and start typing the word “Preview”. This can be seen in the short video below:
The live reload feature is pretty straight forward. Just use the Preview in Browser option, switch back to your document and make changes. When you save you can come back to the browser it it should have reloaded with your changes. This is covered in the Tuts+ Video Lesson on Live Reload.
How to customize the interface
There are additional ways to customize the interface like changing the font size and so forth. The one thing that I had to get used to here is that the settings are text based rather than in a GUI window, and there are user settings vs. default settings. Watch the Tuts+ Video on it. It is covered very well there.
How to use some of the keyboard shortcuts
Again, there is no point for me to reiterate what is covered in the Tuts+ Video on keyboad shortcuts, but the one I have to mention is the command+D shortcut. This enables multiple cursors and allows you to select text and make mass changes. You can see this in the short video below.
How to work with a project
Another element of benefit to me is the ability to work inside a project. This is what really helped me to manage where I am in a document, what its related to, and quickly jump to other files in the project. The following video shows you how to setup a project.
Using Marked for Document Preview
One last thing that I wanted to talk about was using Marked to preview the document with another shortcut that has proven to be very beneifical. What I do here is I use the build option in Sublime Text 2 so that it builds my Markdown document and presents it in Marked. To set this you need the Marked Bonus Pack. As mentioned on the linked site you need copy the Marked.sublime-build file to
/Library/Application Support/Sublime Text 2/Packages/User/. Once you have done this Marked will show up as a build system and you can then use
command + b to build the document in Marked as seen below:
As you can tell there is a great deal that you can do with Sublime Text 2. I’m really just getting started with it and I know as time goes by I’ll become more adept at its advanced functions, but for now this has really worked well for me. I think at this point I’m going to give the search for the best editor a rest and call it sublime text 2. Of course, it’s not perfect, but what app is?