The template system used by Sphinx makes this rather easy, just the selector for the HTML element to inject to needs to be extended.