About
Detergent is a tool to prepare a text for pasting into HTML.
The main idea is, we need a program which, on default settings and with the least effort will make any text safe and optimal for pasting into HTML.
Text on web pages and email templates should look at its best:
- text should be HTML-encoded
- text should have no invisible characters
- text should use smart curly quotes and n/m-dashes where applicable
These requirements are quite universal, and default settings of Detergent.io are aiming precisely at them.
Alternatively, Detergent can be used to strip HTML and prepare a text for non-HTML uses, for example, pasting into PSD or Sketch design files.
Architecture
Conceptually, this web page, detergent.io, is separate from its API, an Open Source npm package detergent
(npm page / monorepo).
Detergent-the-npm-package is separate from Detergent.io (this website) to allow other people to use Detergent in their programs, websites, Gulp tasks and everywhere else.
For the same reasons, all the major functions in the API are also separated into separate npm packages:
html-entities-not-email-friendly
(npm page / monorepo) — a list of all named HTML entities which are not email-friendly — we use it when encoding, to know when to switch to numeric HTML entities
string-apostrophes
(npm page / monorepo) — typographically-corrects all kinds of apostrophes to left/right single quotes or primes.
string-collapse-white-space
(npm page / monorepo) — does what it says on the tin — collapses whitespace in a string: " aaa bbbb " → "aaa bbbb", also trims the input and crunches the line breaks
string-fix-broken-named-entities
(npm page / monorepo) — fixes broken named HTML entities, for example,
&nbs;
, a non-breaking space with missing "p" is clearly an error and no similar entities exist, it is an
and needs to be fixedstring-remove-widows
(npm page / monorepo) — widow word removal
string-strip-html
(npm page / monorepo) — non-parsing HTML tag processor which detects HTML tags in mixed source code (anything, including ESP code, templating languages, programming languages, you name it) — tag recognition, stripping and skipping features are based on this program
there are few more, but above are the main ones.
The main features of detergent.js, our API:
- Encodes all characters outside ASCII using named HTML entities if they are supported across email clients, falls back to numeric otherwise
- Removes all invisible characters like ETX
- Improves English style: converts dashes to n/m dashes, apostrophes to curly quotes and so on — two English Grammar books have been coded up
- Prevents widow words
- API reports all settings that are not applicable for the current input — UI greys them out to save you from mental fatigue
- Recognises HTML, let's you granularly strip or skip arbitrary tags
The main features of this web app
- Vanilla, client-side-only, all-static HTML+CSS+JavaScript, served from CDN edge via HTTPS
- Instant result, calculated on a web worker
- Always the latest API is consumed straight from NPM via unpkg —this web app is never out of date
- Dark and light modes without ever flashing the opposite colour
- Preferences saved in browser's local storage
- No cookies of any kind
- No advertising, sales or sneaky lead-gen
Main competition
There are no programs on the market comparable to Detergent.
he.js package is used by Detergent — it's driving the Detergent's HTML-encoding.
Email On Acid Character Converter is way inferior to he.js
— to start with, it will neither remove invisible characters from text nor encode them. It's UI sucks, and it's ridden with marketing lead-gen.
Typograf (app/package) seems at first glance like a comparable app, but it's aimed at text preparation for web pages in the Russian language. Typograf's UI has English switch, but it has just a basic set of rules for n/m dashes and apostrophes. Typograf can't be used as an encoding tool either — £
is not even encoded, for example. Typograf's UI could be improved speaking mildly; it's got 97 settings with no filtration what is applicable for a given input, all hidden in the sidebar and not quite user-friendly.
Detergent | Email on Acid Character Converter | he.js | Typograf | |
---|---|---|---|---|
Encodes using named HTML entities (£ ) instead of numeric (£ ) so that you can read and understand your text after encoding |
✅ | ❌ | ✅ | ❌ |
Will recognise named HTML entities which are not supported on email ESP's and will fall back to numeric | ✅ | ❌ | ❌ | ❌ |
Input and output on the same screen, instantly | ✅ | ❌ | ✅ | ✅ |
Removes invisible characters | ✅ | ❌ (silently skips) | ❌ (only encodes) | ❌ |
Fixes English style | ✅ | ❌ | ❌ | partially |
HTML tag-aware with granular tag whitelisting | ✅ | ❌ | ❌ | ❌ |
Optionally skips encoding non-Latin characters | ✅ | ❌ | ❌ | ❌ |
Prevents widow words | ✅ | ❌ | ❌ | ❌ |
Recognises and granularly strips/skips HTML tags | ✅ | ❌ | ❌ | ❌ |
Campaign-code (ESP-tags) friendly | ✅ | ❌ | ❌ | ❌ |
API with its unit tests available publicly for inspection | ✅ | ❌ | ✅ | ✅ |
Free, non-profit and Open Source API as an npm library | ✅ | ❌ | ✅ | ✅ |
MIT License
Copyright (c) 2015–2019 Roy Revelt and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Contacts
Detergent.io and Detergent.js were created and are maintained by Codsen Ltd.
Please report anything wrong you see on the UI or request new features by emailing roy@codsen.com or tweeting Roy @revelto
If you see anything wrong with any of the packages, raise an issue on GitLab, on our monorepository