It felt a little weird leaving this as an instance method of Editor given that it no longer has any dependency on Editor... but there didn't seem to be many cleaner homes for it (a static method on either Editor or Document feels imperfect too... and usually adds a module import that wasn't needed otherwise... but I'm open to moving it there if preferred).