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 ofParser
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
ThePegDownProcessor
used to convert Pegdown documents to HTML.static java.lang.String
ROLE_HINT
The role hint for theMarkdownParser
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, 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 theMarkdownParser
Plexus component.- See Also:
- Constant Field Values
-
PEGDOWN_PROCESSOR
protected static final org.pegdown.PegDownProcessor PEGDOWN_PROCESSOR
ThePegDownProcessor
used to convert Pegdown documents to HTML.
-
-
Method Detail
-
getType
public int getType()
Description copied from class:AbstractParser
- Specified by:
getType
in interfaceParser
- Overrides:
getType
in classAbstractParser
- Returns:
- the type of Parser
-
parse
public void parse(java.io.Reader source, Sink sink) throws ParseException
Description copied from interface:Parser
Parses the given source model and emits Doxia events into the given sink.- Parameters:
source
- not null reader that provides the source document. You could usenewReader
methods 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)
-
-