Class FixSvgMojo

java.lang.Object
network.ike.docs.plugin.FixSvgMojo
All Implemented Interfaces:
org.apache.maven.api.plugin.Mojo

@Mojo(name="fix-svg", defaultPhase="process-resources") public class FixSvgMojo extends Object implements org.apache.maven.api.plugin.Mojo
Remove bare <rect/> elements from generated HTML files.

Mermaid generates <rect/> elements (no attributes) as non-functional placeholders inside flowchart label groups. These elements violate the SVG spec (missing required width/height) and cause warnings in Prince and other PDF renderers.

Replaces: fix-inline-svg.sh

Usage:

mvn ike:fix-svg -DhtmlFile=target/generated-docs/html/document.html
  • Constructor Details

    • FixSvgMojo

      public FixSvgMojo()
      Creates this goal instance.
  • Method Details

    • getLog

      protected org.apache.maven.api.plugin.Log getLog()
      Access the Maven logger.
      Returns:
      the logger
    • execute

      public void execute() throws org.apache.maven.api.plugin.MojoException
      Specified by:
      execute in interface org.apache.maven.api.plugin.Mojo
      Throws:
      org.apache.maven.api.plugin.MojoException
    • removeBareRects

      public static String removeBareRects(String html)
      Remove all bare <rect/> elements from HTML content.
      Parameters:
      html - the HTML content
      Returns:
      cleaned HTML with bare rects removed
    • countBareRects

      public static int countBareRects(String html)
      Count occurrences of bare <rect/> elements in HTML content.
      Parameters:
      html - the HTML content
      Returns:
      number of bare rect elements found