<commit_before># pygmentizr

Pygmentizr is a web app that takes code, and returns HTML with syntax colouring, using the [Pygments library][1].

For motivation, see the [accompanying blog post][2].

## Installation

Clone this repository, create a virtualenv, then install the requirements with pip:

```console
$ git clone <EMAIL>:alexwlchan/pygmentizr.git
$ cd pygmentizr
$ virtualenv env; source env/bin/activate
$ pip install -r requirements.txt
```

## Configuration

The list of lexers/language choices is specified in `config.py`. Here's an example:

```python
from pygments.lexers import *

SELECTED_LEXERS = OrderedDict([
    ('Python',           PythonLexer),
    ('Python console',   PythonConsoleLexer),
    ('CoffeeScript',     CoffeeScriptLexer),
    ('CSS',              CssLexer),
])
```

For each language you want to include, add a tuple to `SELECTED_LEXERS`.
The first item should be the name you want to appear in the interface, the second the lexer object from Pygments.

## Running the app

To run a local instance, invoke as follows:

```console
$ cd /path/to/pygmentizr
$ source env/bin/activate
$ python manage.py run
```

This starts the Flask instance which runs Pygmentizr. Point a web browser at <http://localhost:5000> to use the app.

## Acknowledgements

The favicon is the [fa-code icon][3] from the [Font Awesome][4] toolkit.

[1]: http://pygments.org
[2]: http://www.alexwlchan.net/2015/03/pygmentizr
[3]: http://fortawesome.github.io/Font-Awesome/icon/code/
[4]: http://fortawesome.github.io/Font-Awesome/<commit_msg>Add a link to the demo<commit_after># pygmentizr

Pygmentizr is a web app that takes code, and returns HTML with syntax colouring, using the [Pygments library][1].

For motivation, see the [accompanying blog post][2].

You can try a [live demo](https://alexwlchan.net/experiments/pygmentizr/) of the app.

## Installation

Clone this repository, create a virtualenv, then install the requirements with pip:

```console
$ git clone <EMAIL>:alexwlchan/pygmentizr.git
$ cd pygmentizr
$ virtualenv env; source env/bin/activate
$ pip install -r requirements.txt
```

## Configuration

The list of lexers/language choices is specified in `config.py`. Here's an example:

```python
from pygments.lexers import *

SELECTED_LEXERS = OrderedDict([
    ('Python',           PythonLexer),
    ('Python console',   PythonConsoleLexer),
    ('CoffeeScript',     CoffeeScriptLexer),
    ('CSS',              CssLexer),
])
```

For each language you want to include, add a tuple to `SELECTED_LEXERS`.
The first item should be the name you want to appear in the interface, the second the lexer object from Pygments.

## Running the app

To run a local instance, invoke as follows:

```console
$ cd /path/to/pygmentizr
$ source env/bin/activate
$ python manage.py run
```

This starts the Flask instance which runs Pygmentizr. Point a web browser at <http://localhost:5000> to use the app.

## Acknowledgements

The favicon is the [fa-code icon][3] from the [Font Awesome][4] toolkit.

[1]: http://pygments.org
[2]: http://www.alexwlchan.net/2015/03/pygmentizr
[3]: http://fortawesome.github.io/Font-Awesome/icon/code/
[4]: http://fortawesome.github.io/Font-Awesome/

{'fraction_non_alphanumeric': 0.11308965948141206, 'fraction_numerical': 0.011246485473289597, 'mean_word_length': 4.098726114649682, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, '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': '5945967', 'n_tokens_mistral': 1073, 'n_tokens_neox': 990, 'n_words': 357}