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
- Host: GitHub
- URL: https://github.com/oscarotero/typofixer
- Owner: oscarotero
- License: mit
- Created: 2017-02-19T14:54:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-12-16T18:11:18.000Z (over 4 years ago)
- Last Synced: 2025-03-18T15:55:07.801Z (about 1 year ago)
- Topics: fixer, html, microtypography, orthotypography, typography
- Language: PHP
- Homepage:
- Size: 58.6 KB
- Stars: 7
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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