This Python script scans your Publii site's SQLite database and updates text inside posts to:
- Correctly apply diaereses (¨) to appropriate words (e.g.,
cooperate➔coöperate) - Optionally replace straight quotes with smart (curly) quotes (e.g.,
"example"➔“example”) - Correct common informal word usages (e.g.,
anyways➔anyway,gonna➔going to)
It ensures a more precise, formal, and polished English writing style across your site.
Readers deserve beautiful and accurate type. Though the diaeresis (¨) has largely fallen out of everyday use in modern English, it serves an important linguistic purpose: providing clarity in pronunciation by indicating where adjacent vowels should be separated into distinct syllables. Without it, words like “cooperate” or “reenter” may briefly confuse readers, who might misinterpret the structure of the word. Properly applied, the diaeresis preserves the rhythm, flow, and precision of English. “Cooperate” becomes “coöperate” and “reenter” becomes “reënter.” While most publications have abandoned its use, The New Yorker has notably and bravely maintained the tradition, recognizing that careful attention to typography can enhance both the clarity and the beauty of language.
Similarly, replacing straight quotation marks with smart (curly) quotes enhances typographic quality and aligns your site with professional publishing standards.
This script allows you to make these corrections automatically across your Publii site.
- Connects directly to your site's
db.sqlitefile. - Scans the
poststable, updating thetitleandtextfields. - Only words listed in the internal dictionary are replaced — no uncontrolled edits.
- Optionally replaces straight quotes with properly matched opening/closing smart quotes.
- Supports dry-run mode to preview changes without modifying your database.
- Automatically creates a backup (
db.sqlite.bak) unless disabled.
Before:
Cooperation and "coordination" are key to reevaluating our plans.
After:
Coöperation and “coördination” are key to reëvaluating our plans.
Please read carefully before using this tool.
- Always make your own manual backup of your Publii site's
db.sqlitefile before running the script — even though the script will automatically create a.bakcopy. - If used improperly or on the wrong file, the script could unintentionally modify your database.
- Always run a
--dry-runfirst to preview the changes. - Only proceed with full updates once you have verified the changes are safe and appropriate for your site.
Use at your own risk.
- Python 3.8 or newer (comes with SQLite support).
First, make sure to back up your Publii site as changes made are not reversible.
Clone this repository or download the script:
git clone https://github.com/your-username/publii-diaeresis-updater.git
cd publii-diaeresis-updaterOpen diaeresis-updater.py and modify this line to point to your database:
sqlite_file = "/path-to-your-Publii-folder/sites/site-name/input/db.sqlite"Preview changes without modifying anything:
python3 diaeresis-updater.py --dry-runApply changes to your database:
python3 diaeresis-updater.pySkip the backup (optional, not recommended)
python3 diaeresis-updater.py --no-backupAdjusting settings (optional)
Inside the script:
apply_smart_quotes = True # Set to False to disable smart quotes replacementExample output:
📋 Words that would be changed (dry run):
- [posts][row 21][text]: website ➔ Web site
- [posts][row 33][text]: webpage ➔ Web page, smart quotes applied
- [posts][row 68][text]: website ➔ Web site
- [posts][row 108][text]: Cooperation ➔ Coöperation, Reemphasize ➔ Reëmphasize, smart quotes applied
With the changes made in the database, press the "Sync your website" button on Publii to push all changes to your live website.
- This script always makes a backup of your Publii database before running unless
--no-backupis specified. - This script directly modifies your database upon execution.
- It only replaces words explicitly defined in its built-in dictionary.
Contributions, bug reports, and suggestions are very welcome!
- Submit an issue to suggest new words or report problems.
- Open a pull request to contribute improvements or features.
Inspired by The New Yorker's dedication to meticulous editorial style and clarity.
Thanks to Publii's developers and the open-source community for accessible, elegant web publishing.