Class MarkdownParser

  • All Implemented Interfaces:
    org.apache.maven.doxia.logging.LogEnabled, org.apache.maven.doxia.parser.Parser

    @Component(role=org.apache.maven.doxia.parser.Parser.class,
               hint="markdown")
    public class MarkdownParser
    extends org.apache.maven.doxia.parser.AbstractParser
    Implementation of Parser for Markdown documents.

    Defers effective parsing to the PegDown library, which generates HTML content then delegates parsing of this content to a slightly modified Doxia Xhtml parser.

    Since:
    1.3
    Author:
    Julien Nicoulaud
    See Also:
    MarkdownToDoxiaHtmlSerializer
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MarkdownParser.PegDownHtmlParser
      Internal parser for HTML generated by PegDown library.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.pegdown.PegDownProcessor PEGDOWN_PROCESSOR
      The PegDownProcessor used to convert Pegdown documents to HTML.
      static java.lang.String ROLE_HINT
      The role hint for the MarkdownParser Plexus component.
      • Fields inherited from interface org.apache.maven.doxia.parser.Parser

        ROLE, TXT_TYPE, UNKNOWN_TYPE, XML_TYPE
    • Constructor Summary

      Constructors 
      Constructor Description
      MarkdownParser()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getType()  
      static boolean isHtmlComment​(org.pegdown.ast.Node node)  
      static java.lang.String nodeText​(org.pegdown.ast.Node node)  
      void parse​(java.io.Reader source, org.apache.maven.doxia.sink.Sink sink)  
      • Methods inherited from class org.apache.maven.doxia.parser.AbstractParser

        doxiaVersion, enableLogging, executeMacro, getBasedir, getLog, getMacroManager, init, isEmitComments, isSecondParsing, parse, parse, setEmitComments, setSecondParsing
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PEGDOWN_PROCESSOR

        protected static final org.pegdown.PegDownProcessor PEGDOWN_PROCESSOR
        The PegDownProcessor used to convert Pegdown documents to HTML.
    • Constructor Detail

      • MarkdownParser

        public MarkdownParser()
    • Method Detail

      • getType

        public int getType()
        Specified by:
        getType in interface org.apache.maven.doxia.parser.Parser
        Overrides:
        getType in class org.apache.maven.doxia.parser.AbstractParser
      • parse

        public void parse​(java.io.Reader source,
                          org.apache.maven.doxia.sink.Sink sink)
                   throws org.apache.maven.doxia.parser.ParseException
        Throws:
        org.apache.maven.doxia.parser.ParseException
      • isHtmlComment

        public static boolean isHtmlComment​(org.pegdown.ast.Node node)
      • nodeText

        public static java.lang.String nodeText​(org.pegdown.ast.Node node)