An open API service indexing awesome lists of open source software.

https://github.com/oscarotero/typofixer

Fix microtypography issues in html code
https://github.com/oscarotero/typofixer

fixer html microtypography orthotypography typography

Last synced: about 1 year ago
JSON representation

Fix microtypography issues in html code

Awesome Lists containing this project

README

          

# Typofixer

A [wip] PHP library to fix microtypography issues in html code.

## Requirements

* PHP ^7.1
* mbstring extension

## Usage

```php
use Typofixer\Typofixer;

$input = '

"Hello"  world...

';
$output = Typofixer::fix($input, ['language' => 'es']);

echo $ouput; //

«Hello» world…


```

## Available fixers:

Name | Description
-----|-------------
**AddSpaceAfter** | Ensure there's a space after some characters like `,:;!?`. Ex: `hello,world` is converted to `hello, world`.
**CharsInside** | Move some characters inside the corresponding tags. Ex: `hello, world` is converted to `hello, world`
**Dash** | Replace the simple `-` between numbers to ndash and `--` to mdash.
**Ellipsis** | Converts `...` into `…`
**MergeTags** | Merge two consecutive tags. Ex: `hello world` is converted to `hello world`
**Quotes** | Replace plain quotes by curly quotes. Ex: `"hello word"` is converted to `“hello world”`
**RemoveEmptyTags** | Removes empty tags or tags containing only spaces. Ex: ` `
**RemoveInnerTags** | Removes some tags that cannot be inside other tags. Ex: `hello world` is converted to `hello world`
**RemoveSpaceBefore** | Removes the space before some characteres like `,:;!?`. Ex: `hello , world` is converted to `hello, world`.
**RemoveSpaceAfter** | Removes the space after some characteres like `¿¡(`. Ex: `hello ( world)` is converted to `hello (world)`.
**Spaces** | Removes duplicated spaces and convert all unicode spaces (like ` `) to simple spaces. Ex: `Hello   world` is converted to `Hello world`.
**SpaceTags** | Normalize spaces between tags. Ex: `hello world` is converted to `hello world`.

## Available options

Name | Description
-----|-------------
`language` | The ISO language code that is used by some fixers like Quotes