I’d like to perform custom HTML transformations using jQuery for WordPress posts database (sanify HTML, rewrite images, etc.) I’d like to use jQuery over XSLT, XPath, etc. because of its power and beauty.
This would be one time batch operation.
What would be the best way to run server-side script which reads SQL database, generates DOM tree, runs jQuery script against it and then puts the resulting HTML back? As far as I know you can do jQuery with node.js, but I am not very familiar with details. I also don’t know what’s the situation with MySQL connectivity and server-side Javascript.
It should be easily done with a Node.js script.
You can read the HTML with this MySQL-driver and for example this jQuery Node.js package can take raw HTML strings as input.
For image manipulation there is node-canvas, but last time I tested it, it could only output PNGs. There are also some Image Magick wrappers for Node which can handle other output formats.