Giter VIP home page Giter VIP logo

grip's Introduction

Grip -- Github Readme Instant Preview

Render local readme files before sending off to Github.

Grip is a command-line server application written in Python that uses the Github markdown API to render a local readme file. The styles also come directly from Github, so you'll know exactly how it will appear.

Motivation

Sometimes you just want to see the exact readme result before committing and pushing to Github.

Especially when doing Readme-driven development.

Installation

To install grip, simply:

$ pip install grip

Usage

To render the readme of a repository:

$ cd myrepo
$ grip
 * Running on http://localhost:5000/

Now open a browser and visit http://localhost:5000.

You can also specify a port:

$ grip 80
 * Running on http://localhost:80/

Or an explicit file:

$ grip AUTHORS.md
 * Running on http://localhost:5000/

Alternatively, you could just run grip and visit localhost:5000/AUTHORS.md since grip supports relative URLs.

GitHub-Flavored Markdown is also supported:

$ grip --gfm --context=joeyespo/grip
 * Running on http://localhost:5000/

For more details, see the help:

$ grip -h

API

You can access the API directly with Python, using it in your own projects:

from grip import serve

serve(port=8080)
 * Running on http://localhost:80/

Documentation

serve

Runs a local server and renders the Readme file located at path when visited in the browser.

serve(path='file-or-directory', host='localhost', port=5000, gfm=False, context=None, render_offline=False)
  • path: The filename to render, or the directory containing your Readme file
  • host: The host to serve on
  • port: The port to serve on
  • gfm: Whether to render using GitHub Flavored Markdown
  • context: The project context to use when gfm is true, which takes the form of username/project
  • render_offline: Whether to render locally using Python-Markdown

render_content

Renders the specified markdown text.

render_content(text, gfm=False, context=None)
  • text: The content to render
  • gfm: Whether to render using GitHub Flavored Markdown
  • context: The project context to use when gfm is true, which takes the form of username/project
  • render_offline: Whether to render locally using Python-Markdown

render_page

Renders the specified markdown text and outputs an HTML page that resembles the GitHub Readme view.

render_page(text, filename=None, gfm=False, context=None, render_offline=False, style_urls=[])
  • text: The content to render
  • gfm: Whether to render using GitHub Flavored Markdown
  • context: The project context to use when gfm is true, which takes the form of username/project
  • render_offline: Whether to render offline using Python-Markdown
  • style_urls: A list of URLs that contain CSS to include in the rendered page

default_filenames

This constant contains the names Grip looks for when no file is given to.

default_filenames = ['README.md', 'README.markdown']

Contributing

  1. Check the open issues or open a new issue to start a discussion around your feature idea or the bug you found
  2. Fork the repository, make your changes, and add yourself to Authors.md
  3. Send a pull request

grip's People

Contributors

briancappello avatar hydhknn avatar isbadawi avatar joelittlejohn avatar joeyespo avatar vladwing 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.