<commit_before>Grip -- GitHub Readme Instant Preview
=====================================

[![Current version on PyPI](http://img.shields.io/pypi/v/grip.svg)][pypi]
<a href="https://gratipay.com/grip/" title="Thank you!" target="_blank">
  <img src="https://img.shields.io/gratipay/grip.svg" alt="Thank you!">
</a>

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][markdown] to render a local readme file. The styles
come directly from GitHub, so you'll know exactly how it will appear. Changes
you make to the Readme will be instantly reflected in the browser without
requiring a page refresh.


Motivation
----------

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

Especially when doing [Readme-driven development][rdd].


Installation
------------

To install grip, simply:

```bash
$ pip install grip
```

On OS X, you can also install with Homebrew:

```bash
$ brew install grip
```


Usage
-----

To render the readme of a repository:

```bash
$ cd myrepo
$ grip
 * Running on http://localhost:6419/
```

Now open a browser and visit [http://localhost:6419](http://localhost:6419/).
Or run with `-b` and Grip will open a new browser tab for you.

You can also specify a port:

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

Or an explicit file:

```bash
$ grip AUTHORS.md
 * Running on http://localhost:6419/
```

Alternatively, you could just run `grip` and visit [localhost:6419/AUTHORS.md][AUTHORS.md]
since grip supports relative URLs.

You can combine the previous examples. Or specify a hostname instead of a port. Or provide both.

```bash
$ grip AUTHORS.md 80
 * Running on http://localhost:80/
```

```bash
$ grip CHANGES.md 0.0.0.0
 * Running on http://0.0.0.0:6419/
```

```bash
$ grip . 0.0.0.0:80
 * Running on http://0.0.0.0:80/
```

You can even bypass the server and **export** to a single HTML file, with all the styles and assets inlined:

```bash
$ grip --export
Exporting to README.html
```

Control the output name with the second argument:

```bash
$ grip README.md --export readme.html
Exporting to readme.html
```

If you're exporting a bunch of files, you can prevent styles from being inlining to save space with `--no-inline`:

```bash
$ grip README.md --export --no-inline introduction.html
Exporting to introduction.html
```
<commit_msg>Use 'index.html' in --export example for searchability.<commit_after>Grip -- GitHub Readme Instant Preview
=====================================

[![Current version on PyPI](http://img.shields.io/pypi/v/grip.svg)][pypi]
<a href="https://gratipay.com/grip/" title="Thank you!" target="_blank">
  <img src="https://img.shields.io/gratipay/grip.svg" alt="Thank you!">
</a>

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][markdown] to render a local readme file. The styles
come directly from GitHub, so you'll know exactly how it will appear. Changes
you make to the Readme will be instantly reflected in the browser without
requiring a page refresh.


Motivation
----------

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

Especially when doing [Readme-driven development][rdd].


Installation
------------

To install grip, simply:

```bash
$ pip install grip
```

On OS X, you can also install with Homebrew:

```bash
$ brew install grip
```


Usage
-----

To render the readme of a repository:

```bash
$ cd myrepo
$ grip
 * Running on http://localhost:6419/
```

Now open a browser and visit [http://localhost:6419](http://localhost:6419/).
Or run with `-b` and Grip will open a new browser tab for you.

You can also specify a port:

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

Or an explicit file:

```bash
$ grip AUTHORS.md
 * Running on http://localhost:6419/
```

Alternatively, you could just run `grip` and visit [localhost:6419/AUTHORS.md][AUTHORS.md]
since grip supports relative URLs.

You can combine the previous examples. Or specify a hostname instead of a port. Or provide both.

```bash
$ grip AUTHORS.md 80
 * Running on http://localhost:80/
```

```bash
$ grip CHANGES.md 0.0.0.0
 * Running on http://0.0.0.0:6419/
```

```bash
$ grip . 0.0.0.0:80
 * Running on http://0.0.0.0:80/
```

You can even bypass the server and **export** to a single HTML file, with all the styles and assets inlined:

```bash
$ grip --export
Exporting to README.html
```

Control the output name with the second argument:

```bash
$ grip README.md --export index.html
Exporting to index.html
```

If you're exporting a bunch of files, you can prevent styles from being inlining to save space with `--no-inline`:

```bash
$ grip README.md --export --no-inline introduction.html
Exporting to introduction.html
```

{'fraction_non_alphanumeric': 0.14157851912123678, 'fraction_numerical': 0.02115541090317331, 'mean_word_length': 3.806451612903226, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '34556', 'n_tokens_mistral': 1661, 'n_tokens_neox': 1490, 'n_words': 614}