Skip to content
Preview Markdown files (such as a README) exactly how it will appear on Github
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Address some rubocop offenses Sep 30, 2019
spec Address some rubocop offenses Sep 30, 2019
.gitignore Adds Changelog Sep 30, 2019
LICENSE.txt Gem skeleton and README Nov 19, 2012 Update on dependencies and preparing updated release Sep 30, 2019
Rakefile Address some rubocop offenses Sep 30, 2019
ghpreview.gemspec Final details before new release 0.2.0 Sep 30, 2019


When you're writing a README for your project, you want a way to preview the Markdown locally before you push it. ghpreview is a command-line utility that opens your Markdown file in a browser. It uses Github styling and (optionally) automatically refreshes every time you save your source.

While README files are the most common use case, ghpreview works with any Markdown file.


You'll need the icu library. If you're on a Mac, brew install icu4c will do the trick.


$ gem install ghpreview


$ ghpreview

This will open your default browser with a preview of exactly as it will appear on Github. For a live-updating preview, use the -w (or --watch) option:

$ ghpreview -w

To use an alternate browser, use the -a (or --application) option:

# On Mac:
$ ghpreview -a

# On GNU/Linux:
$ ghpreview -a konqueror

Why is this better than X?

There are several tools available for previewing Markdown files, and many that provide a Github-like style. I've personally used Marked, Mou, and the vim-markdown plugin. All are good tools, but none are able to truly reproduce the custom features added to Github Flavored Markdown. This is especially notable with fenced code blocks and syntax highlighting.

ghpreview is an accurate preview because it uses Github's own HTML processing filters to generate the HTML, and Github's own stylesheets to style it :octocat:


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Write specs (bundle exec rspec spec)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request
You can’t perform that action at this time.