Class MarkdownRenderer
java.lang.Object
org.codehaus.groovy.tools.groovydoc.MarkdownRenderer
GROOVY-11542: support for JEP 467 Markdown documentation comments
(triple-slash
/// runs, captured by GroovydocVisitor).
Two concerns are kept here:
- Splitting a raw comment body into its Markdown body (the prose) and
its Javadoc block-tag trail (
@param,@return, …). Block-tag detection matches Javadoc's JEP 467 rule: a line is a block tag when its first non-blank character is@, it is not inside a fenced code block (```/~~~), and the@is followed by a tag word (an ASCII letter). - Rendering the Markdown body to HTML. Headings are shifted down by
two levels (
#→<h3>,##→<h4>, …) so they slot under the class/member page's own<h1>and<h2>structure, matching Javadoc's layout.
The renderer is stateless and thread-safe; a single Parser +
HtmlRenderer pair is cached per class.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringRender a Markdown body to HTML and shift heading levels down so that JEP 467 top-level headings (#) become<h3>, fitting under the page's existing<h1>/<h2>structure.static String[]splitBodyAndTags(String raw) Split a raw comment body (already stripped of///prefixes) into its Markdown body and block-tag trail.static StringunmaskBracesInCode(String html) Translate the/placeholders left inside code spans / code blocks byrender(String)back to literal{/}numeric HTML entities, so browsers display them as{} and {@code }while keeping the content distinguishable from tag syntax.
-
Method Details
-
splitBodyAndTags
Split a raw comment body (already stripped of///prefixes) into its Markdown body and block-tag trail. Returns a two-element array[body, tags]; either may be empty. -
render
Render a Markdown body to HTML and shift heading levels down so that JEP 467 top-level headings (#) become<h3>, fitting under the page's existing<h1>/<h2>structure. -
unmaskBracesInCode
Translate the/placeholders left inside code spans / code blocks byrender(String)back to literal{/}numeric HTML entities, so browsers display them as{} and {@code }while keeping the content distinguishable from tag syntax. Called afterTagRendererhas run so inline-tag expansion has already skipped over them.
-