Giter Site home page Giter Site logo

ghpreview's Introduction

ghpreview

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.

Prerequisites

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

Installation

$ gem install ghpreview

Usage

$ ghpreview README.md

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

$ ghpreview -w README.md

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

# On Mac:
$ ghpreview -a Safari.app README.md

# On GNU/Linux:
$ ghpreview -a konqueror README.md

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:

Contributing

  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

ghpreview's People

Contributors

adamlogic avatar picandocodigo avatar mdoel avatar theotherzach avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.