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.
Sometimes you just want to see the exact readme result before committing and pushing to Github.
Especially when doing Readme-driven development.
To install grip, simply:
$ pip install grip
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 CHANGES.md
* Running on http://localhost:5000/
Or you can even export the file to a monolithic html:
$ grip --export CHANGES.md
will give you a monolithic Html with all stylesheets included
GitHub-Flavored Markdown is also supported:
$ grip --gfm --context=joeyespo/grip
* Running on http://localhost:5000/
For more details, see the help:
$ grip -h
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/
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)
path
: The filename to render, or the directory containing your Readme filehost
: The host to serve onport
: The port to serve ongfm
: Whether to render using GitHub Flavored Markdowncontext
: The project context to use whengfm
is true, which takes the form ofusername/project
Renders the specified markdown text.
render_content(text, gfm=False, context=None)
text
: The content to rendergfm
: Whether to render using GitHub Flavored Markdowncontext
: The project context to use whengfm
is true, which takes the form ofusername/project
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, style_urls=[])
text
: The content to rendergfm
: Whether to render using GitHub Flavored Markdowncontext
: The project context to use whengfm
is true, which takes the form ofusername/project
style_urls
: A list of URLs that contain CSS to include in the rendered page
This constant contains the names Grip looks for when no file is given to.
default_filenames = ['README.md', 'README.markdown']
- Check the open issues or open a new issue to start a discussion around your feature idea or the bug you found
- Fork the repository
- Send a pull request