publish: cleaned up some code and added smarter editor

generated from commit 3b92eec31e89aa140a618b3415810df06d69ad57