dont parse the file twice
Even now it is being parsed twice isn't it? Now I see the why you started the Tilt extension :)
it's parsing the markdown twice, once with TOC and second with Glorify::Renderer. but I assume that this will prevent it from reading the file twice from disk, which using the markdown from memory should be faster.