Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


8. November 2012

As I've been working more and more on Mac these days, I've been looking for a Mac based blogging solution and I ended up purchasing MarsEdit.  Everything worked out pretty well, except pasting highlighted source code.

 

I finally solved that final piece of the equation using a product in the middle, SublimeText.  Before continuing, you need to install the plugin Sublime Highlight.  To install, simply git clone the package into your Sublime Text packages folder, like so:

cd ~/Library/Application Support/Sublime Text 2/Packages/
git clone https://github.com/n1k0/SublimeHighlight.git

Now start up SublimeText and you should see an additional option in the Edit menu, Highlight:

 

Sublime Text edit menu

 

Now all you need to do is edit your sublime preferences, choose Preferences->Package Settings->Sublime Highlight->Settings User.

It will open an empty config file, simply add the following:

{

    "theme": "murphy",

    "linenos": "inline",

    "noclasses": true

}

 

The most important value there is noclasses, as otherwise MarsEdit will strip the formatting when you paste your code excerpt.  Theme is the syntax highlighting theme to use and can be one of the following:

  • autumn
  • borland
  • bw
  • colorful
  • default
  • emacs
  • friendly
  • fruity
  • manni
  • monokai
  • murphy
  • native
  • pastie
  • perldoc
  • rrt
  • tango
  • trac
  • vim
  • vs
Now simply paste your code example in Sublime Text, select the portion you want to copy and choose Edit->Highlight->Copy to Clipboard as RTF.  In MarsEdit you simply paste the results while in RTF mode.  Now, presto… formatted code samples!
 

server.get('/imageSize/:name',function(req,res){

   im.identify(files[req.params.name].path,function(err,features){

       console.log("image/" + req.params.name);

       if(err) throw err;

       else

        res.json({ "width":features.width, "height":features.height });

   });

});

 

server.get('/getPhotos', function(req,res){

    res.json(files);

 

});

 

Mission complete, I am now fully functional blogging on Windows and Mac. :)

General

blog comments powered by Disqus

Month List

Popular Comments