Markdown formatting improvements
Extract the first H1 level string from the documentation and make that
the HTML page title. Embed a small block of CSS that makes the style
of the page look more like the rest of the Gerrit documentation pages.
Wrap the entire pegdown output in a proper HTML tag.
The pegdown.css is cached when read from a JAR, but loads on demand
when read from a file:// URL. This enables a fast edit-view cycle of
the style sheet when running the server from within Eclipse or another
IDE that loads the resources from the source tree.
If the Documentation/ URL ends with / redirect to look for index.html
instead. This provides some simple support for directory indexes by
allowing directory references to jump to the index.html document,
which might be index.md in the JAR.
If the plugin doesn't answer to / on its own, redirect web requests
for /plugins/NAME to /plugins/NAME/Documentation/index.html allowing
the user to at least see the documentation.
Only attempt to convert resources that end with ".md" from Markdown to
HTML, rather than everything.
Documentation and static resources are only available by GET and HEAD
HTTP methods. POST, PUT, DELETE, etc. will fail with an error.
If there is no index.html or index.md in Documentation/, render one on
the fly by creating a listing of documentation pages, extracting their
titles and rendering it using the MarkdownFormatter. This keeps the
style consistent with the rest of the documentation in a plugin.
When rendering Documentation files from Markdown to HTML, replace the
macro @PLUGIN@ with the current name of the plugin. This allows
authors to write documentation with reasonably accurate examples that
adjusts automatically based on the installation.
Also support @URL@, @SSH_HOST@, and @SSH_PORT@ replacements in
Markdown documentation for common ways to reference this server.
Macros that start with \ such as \@KEEP@ will render as @KEEP@
even if there is an expansion for KEEP in the future.
Formatted documentation and other static resources for plugins are
cached in memory, to save response time when sending frequently
requested items to clients.
Change-Id: I988038021d4a047bd008561aeedc3ccfd5a1b294
6 files changed