degrotesque — A web type setter.
degrotesque beautifies the web.
degrotesque is a Python script. It loads a text/markdown/HTML/XML file from the disc — or several in batch — and for each, it replaces some commonly used non-typographic characters, such as ", ', -, etc. into their typographic representation for improving the pages' appearance.
"Well - that's not what I had expected."
“Well — that's not what I had expected.”
I think it looks much better.
The starting and ending quotes have been replaced by “ and ”, respectively, the ' by ' and the - by an —. Of course, this script omits HTML-elements. It keeps the complete format as-is, and replaces characters by their proper HTML entity name or the respective unicode character.
It is meant to be a relatively reliable post-processing step for type setting web pages before releasing them. Being a Python script, it can be easily embedded in own workflows. In version 3.0.0 the support of markdown files was added.
degrotesque supports English, German, and French alternatives currently.
degrotesque -i my_page.html -a quotes.german
Replaces single and double quotes within the file “my_page.html” by their typographic German counterparts.
degrotesque -i my_folder -r --no-backup
Applies the default actions to all files in the folder “my_folder” and all subfolders. No backup files are generated. The format of each file is determined using the respective file's extension.
I often write my texts and web pages using a plain editor. As such, the character " is always used for quotes, a dash is always a minus, etc.
I wanted to have a tool that automatically recognizes which characters should be replaced by their more typographic counterpart and applies the according rules.
I think it’s a pity that major Desktop Publishing applications do this on the fly but many and even major web sites still show us plain ASCII characters.
degrotesque does the job pretty fine. After writing / building my pages, the tool converts them to a prettier and typographically more correct form. The structure and format of the pages is completely remained. And as said, it works reliable.
If you need any consultations, please let me know. If you know better, too.
As degrotesque can meanwhile parse not only HTML and plain text files, but as well Markdown files, the next step would be to open it to other file formats as well. As well, other languages besides English, German, and French could be covered.
- Add support for further file and mark types.
- Add support for further languages.
We would love to extend degrotesque to cover these use cases, but only if someone is interested :-) You may drop us a mail at email@example.com.
degrotesque is licensed under the BSD license.