Class MarkdownParser
- java.lang.Object
-
- org.apache.maven.doxia.parser.AbstractParser
-
- org.apache.maven.doxia.module.markdown.MarkdownParser
-
- All Implemented Interfaces:
LogEnabled,Parser
@Component(role=Parser.class, hint="markdown") public class MarkdownParser extends AbstractParser
Implementation ofParserfor 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 classMarkdownParser.PegDownHtmlParserInternal parser for HTML generated by PegDown library.
-
Field Summary
Fields Modifier and Type Field Description protected static org.pegdown.PegDownProcessorPEGDOWN_PROCESSORThePegDownProcessorused to convert Pegdown documents to HTML.static java.lang.StringROLE_HINTThe role hint for theMarkdownParserPlexus 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 intgetType()static booleanisHtmlComment(org.pegdown.ast.Node node)static java.lang.StringnodeText(org.pegdown.ast.Node node)voidparse(java.io.Reader source, Sink sink)Parses the given source model and emits Doxia events into the given sink.-
Methods inherited from class org.apache.maven.doxia.parser.AbstractParser
doxiaVersion, enableLogging, executeMacro, getBasedir, getLog, getMacroManager, init, isEmitComments, isSecondParsing, parse, parse, setEmitComments, setSecondParsing
-
-
-
-
Field Detail
-
ROLE_HINT
public static final java.lang.String ROLE_HINT
The role hint for theMarkdownParserPlexus component.- See Also:
- Constant Field Values
-
PEGDOWN_PROCESSOR
protected static final org.pegdown.PegDownProcessor PEGDOWN_PROCESSOR
ThePegDownProcessorused to convert Pegdown documents to HTML.
-
-
Method Detail
-
getType
public int getType()
Description copied from class:AbstractParser- Specified by:
getTypein interfaceParser- Overrides:
getTypein classAbstractParser- Returns:
- the type of Parser
-
parse
public void parse(java.io.Reader source, Sink sink) throws ParseExceptionDescription copied from interface:ParserParses the given source model and emits Doxia events into the given sink.- Parameters:
source- not null reader that provides the source document. You could usenewReadermethods fromReaderFactory.sink- A sink that consumes the Doxia events.- Throws:
ParseException- if the model could not be parsed.
-
isHtmlComment
public static boolean isHtmlComment(org.pegdown.ast.Node node)
-
nodeText
public static java.lang.String nodeText(org.pegdown.ast.Node node)
-
-