Backport my changes from https://github.com/progrium/viewdocs/pull/17