Richtypo assumes that your text already has right dashes and quotes. The main concern is to add
non-breaking spaces to the right places.
This project is heavily inspired by Artem Sapegin's [richtypo](https://github.com/sapegin/richtypo.js/).
[](https://badge.fury.io/py/richtypo) [](https://travis-ci.org/f213/richtypo.py)
[](https://codecov.io/gh/f213/richtypo.py)
## Features
- Blazing fast, aimed for render-time usage.
- Native Russian support.
- HTML, Markdown and Plain-text aware, does not break your markup.
- Your text stays readable and indexable — richtypo does not produce HTML entities and other messy stuff.
- Easy integration with Jinja2, Django templates and any other language.
- Well tested Python3 and Python2 support. For py2 only unicode input is accepted.
- Easily extendable through smallest possible regular expressions defined in YAML with in-place specifications.
## Installation
```sh
pip install richtypo
```
## Usage
```python
from richtypo import Richtypo
r = Richtypo(ruleset='ru-lite')
well_done = r.richtypo(text)
```
### Jinja2 filter
```python
from richtypo.filter import filter
env = jinja2.Environment(
filters={
'richtypo': filter
}
)
```
Template:
```html
{{ text | richtypo('ru-lite') }}
```
### Django filter
```python
# your_app/templatetags/richtypo.py
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from richtypo.filter import filter as typograph
register = template.Library()
@register.filter
@stringfilter
def richtypo(value, ruleset='generic'):
return mark_safe(typograph(value, ruleset))
```
Template:
```html
{% load richtypo %}
{{ object.text | richtypo:"ru-lite"}}
```
## License
MIT
Metadata
Release files for richtypo 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| richtypo-0.2.3.tar.gz | 11.8 kB | Without provenance | Details for richtypo-0.2.3.tar.gz |
Release files / richtypo-0.2.3.tar.gz
| Download URL | richtypo-0.2.3.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1556e1b22b8f74b926b322cdf46b9bf92a49f0141cfc59c161f9ae4c102dee9c
|
|
BLAKE2b-256 checksum How to use checksums |
0bd69c8a278486f900ffbf6c088dc47e4449c0cd32a91fc0c72f16e232a6520c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for richtypo 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.