Paul King created GROOVY-11950:
----------------------------------
Summary: Add -preLanguage option to syntax-highlight legacy <pre>
blocks
Key: GROOVY-11950
URL: https://issues.apache.org/jira/browse/GROOVY-11950
Project: Groovy
Issue Type: New Feature
Components: groovy-groovydoc
Reporter: Paul King
Assignee: Paul King
Doc comments frequently use plain {{<pre>...</pre>}} blocks for code examples.
Prism's highlighter only walks {{<code>}} descendants of language-classed
elements, so these legacy blocks are skipped even when
{{-syntaxHighlighter=prism}} is on.
Introduce a new {{-preLanguage}} option (CLI) / {{preLanguage}} attribute (Ant
task) that post-processes the generated HTML:
- A bare {{<pre>body</pre>}} is rewritten to {{<pre
class="language-xxx"><code>body</code></pre>}}, using the configured language
id.
- A {{<pre class="language-xxx">}} that lacks an inner {{<code>}} has its body
wrapped in {{<code>}}.
- {{<pre>}} tags with any existing attribute (e.g. {{class="groovyTestCase"}},
author-chosen {{class="language-sql"}}, {{id="..."}}) are left untouched.
Opt-in; no effect when unset. Complements {{-syntaxHighlighter}} rather than
replacing it.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)