This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/mermaid-support
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git

commit 419c72a2efe43b1244ba41798aabf3769f0636cd
Author: Konrad Windszus <[email protected]>
AuthorDate: Sun Jan 11 10:25:58 2026 +0100

    Mermaid support
    
    Extend site descriptor for Mermaid feature.
    
    This closes #611
---
 doxia-site-model/pom.xml                           |  6 +--
 doxia-site-model/src/main/mdo/site.mdo             | 46 +++++++++++++++++++++-
 .../doxia/siterenderer/sink/SiteRendererSink.java  | 23 ++++++++++-
 3 files changed, 70 insertions(+), 5 deletions(-)

diff --git a/doxia-site-model/pom.xml b/doxia-site-model/pom.xml
index 08b2fc3..fa5cfdc 100644
--- a/doxia-site-model/pom.xml
+++ b/doxia-site-model/pom.xml
@@ -84,7 +84,7 @@ under the License.
                 <model>src/main/mdo/site.mdo</model>
               </models>
               <!-- TODO Do not forget to update the version in the 
description. See DOXIASITETOOLS-98. -->
-              <version>2.0.0</version>
+              <version>2.1.0</version>
             </configuration>
           </execution>
           <execution>
@@ -113,7 +113,7 @@ under the License.
                 <model>src/main/mdo/site.mdo</model>
               </models>
               <!-- TODO Do not forget to update the version in the 
description. See DOXIASITETOOLS-98. -->
-              <version>2.0.0</version>
+              <version>2.1.0</version>
             </configuration>
           </execution>
           <execution>
@@ -140,7 +140,7 @@ under the License.
                 <model>src/main/mdo/site.mdo</model>
               </models>
               <!-- TODO Do not forget to update the version in the 
description. See DOXIASITETOOLS-98. -->
-              <version>2.0.0</version>
+              <version>2.1.0</version>
               
<outputDirectory>${project.build.directory}/generated-site/resources/xsd</outputDirectory>
             </configuration>
           </execution>
diff --git a/doxia-site-model/src/main/mdo/site.mdo 
b/doxia-site-model/src/main/mdo/site.mdo
index b9fdd56..a302894 100644
--- a/doxia-site-model/src/main/mdo/site.mdo
+++ b/doxia-site-model/src/main/mdo/site.mdo
@@ -30,7 +30,7 @@ under the License.
     <p>An XSD is available at:</p>
     <ul>
       <!-- There is no property filtering in Modello, this has to be updated 
manually. See DOXIASITETOOLS-98. -->
-      <li><a 
href="https://maven.apache.org/xsd/site-2.0.0.xsd";>https://maven.apache.org/xsd/site-2.0.0.xsd</a></li>
+      <li><a 
href="https://maven.apache.org/xsd/site-2.1.0.xsd";>https://maven.apache.org/xsd/site-2.1.0.xsd</a></li>
     </ul>
     ]]></description>
 
@@ -167,6 +167,18 @@ under the License.
           <version>1.0.1+</version>
           <type>long</type>
         </field>
+        <field xdoc.separator="blank">
+          <name>mermaid</name>
+          <description><![CDATA[
+            Enables rendering of mermaid.js diagrams contained in HTML.
+            Example: <code>$site.custom.getChild( 'customElement' 
).getValue()</code>
+          ]]></description>
+          <version>2.1.0+</version>
+          <association>
+            <type>Mermaid</type>
+          </association>
+          <identifier>true</identifier>
+        </field>
       </fields>
       <codeSegments>
         <codeSegment>
@@ -653,5 +665,37 @@ under the License.
         </field>
       </fields>
     </class>
+    
+    <class java.clone="deep">
+      <name>Mermaid</name>
+      <description>The mermaid.js configuration.</description>
+      <version>2.1.0+</version>
+      <fields>
+        <field xml.attribute="true">
+          <name>externalJsUrl</name>
+          <description>The URL from which to request the Mermaid.js used for 
rendering the diagrams. If not set a built-in version of Mermaid is used (which 
is automatically deployed to the site)</description>
+          <version>2.1.0+</version>
+          <type>String</type>
+          <required>false</required>
+          <identifier>true</identifier>
+        </field>
+        <field xml.attribute="true">
+          <name>useTiny</name>
+          <description>Use Tiny Mermaid 
(https://github.com/mermaid-js/mermaid/tree/develop/packages/tiny#tiny-mermaid).
 Only relevant if "externalJsUrl" is not used.</description>
+          <version>2.1.0+</version>
+          <type>Boolean</type>
+          <required>false</required>
+          <identifier>true</identifier>
+        </field>
+        <field>
+          <name>config</name>
+          <description>The Mermaid configuration in JSON format as described 
in 
https://mermaid.ai/open-source/config/setup/mermaid/interfaces/MermaidConfig.html.</description>
+          <version>2.1.0+</version>
+          <type>String</type>
+          <required>false</required>
+          <identifier>true</identifier>
+        </field>
+      </fields>
+    </class>
   </classes>
 </model>
diff --git 
a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java
 
b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java
index 97c8864..3c8b0ce 100644
--- 
a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java
+++ 
b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java
@@ -130,6 +130,27 @@ public class SiteRendererSink extends Xhtml5Sink 
implements DocumentContent {
         resetTextBuffer();
     }
 
+    
+    @Override
+    public void verbatim(SinkEventAttributes attributes) {
+        // special handling for mermaid
+        String lang = attributes.getAttribute(SinkEventAttributes.LANG);
+        // TODO: check if mermaid support is enabled
+        if ("mermaid".equalsIgnoreCase(lang)) {
+            flushTextBuffer();
+            write("<div class=\"mermaid\">\n");
+            write(getTextBuffer().toString());
+            write("\n</div>\n");
+            resetTextBuffer();
+            addMermaidScriptToEnd();
+            return;
+        } else {
+            super.verbatim(attributes);
+        }
+        // TODO Auto-generated method stub
+        super.verbatim(attributes);
+    }
+
     /**
      * {@inheritDoc}
      *
@@ -210,7 +231,7 @@ public class SiteRendererSink extends Xhtml5Sink implements 
DocumentContent {
     /** {@inheritDoc} */
     public String getBody() {
         String body = writer.toString();
-
+        // TODO: potentially add mermaid script to the end of body
         return body.length() > 0 ? body : null;
     }
 

Reply via email to