Fix directory links in Markdown preview is incorrect
README and preview code uses each own rendering logic, caused diverged
output. An internal directory link inside preview HTML links to 404
(server returns 500) page.
This patch refactors HTML rendering into interface-d one and let both
endpoint use that. The original motivation for this refactor was to
cache rendered HTML, but turns out refactor alone is significant so I
gave this a dedicated commit.