Theme Fixes for MkDocs and ReadTheDocs themes

A rebased and updated version of #59 by @Hernrup.