Create a New Doxia Module

First, the easiest way is to create a POM with doxia-modules as parent:

<project>
  <parent>
    <groupId>org.apache.maven.doxia</groupId>
    <artifactId>doxia-modules</artifactId>
    <version>1.12.0</version> <!-- Latest release -->
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>doxia-module-my</artifactId>
  <name>Doxia :: MY Module</name>

  ...
</project>

Secondly, you should implement some Doxia classes, depending on what features you want: parsing or generating markup.

Parsing

  • MyParser class
    import org.apache.maven.doxia.parser.AbstractParser;
    import org.apache.maven.doxia.parser.Parser;
    import org.codehaus.plexus.component.annotations.Component;
    
    @Component( role = Parser.class, hint = "my" )
    public class MyParser
        extends AbstractParser
    {
    ...
    }

    Depending on the type markup, extending AbstractTextParser, AbstractXmlParser or XhtmlBaseParser may give you more features.

  • MyParseException class (optional)
    import org.apache.maven.doxia.parser.ParseException;
    
    public class MyParseException
        extends ParseException
    {
    ...
    }
  • MyParserModule class
    import org.apache.maven.doxia.parser.module.AbstractParserModule;
    import org.codehaus.plexus.component.annotations.Component;
    
    @Component( role = ParserModule.class, hint = "my" )
    public class MyParserModule
        extends AbstractParserModule
    {
    ...
    }

Generating

  • MySink class
    import org.apache.maven.doxia.sink.SinkAdapter;
    
    public class MySink
        extends SinkAdapter
    {
    ...
    }

    Depending on the type markup, extending AbstractTextSink, AbstractXmlSink or XhtmlBaseSink may give you more features.

  • MySinkFactory class
    import org.apache.maven.doxia.sink.SinkFactory;
    import org.codehaus.plexus.component.annotations.Component;
    
    @Component( role = SinkFactory.class, hint = "my" )
    public class MySinkFactory
        extends SinkFactory
    {
    ...
    }

    Depending on the type markup, extending AbstractTextSinkFactory, AbstractXmlSinkFactory or AbstractBinarySinkFactory may give you more features.

References