@Component(role=Parser.class, hint="markdown") public class MarkdownParser extends AbstractParser
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.MarkdownToDoxiaHtmlSerializer
Modifier and Type | Class and Description |
---|---|
static class |
MarkdownParser.PegDownHtmlParser
Internal parser for HTML generated by PegDown library.
|
Modifier and Type | Field and Description |
---|---|
protected static org.pegdown.PegDownProcessor |
PEGDOWN_PROCESSOR
The
PegDownProcessor used to convert Pegdown documents to HTML. |
static String |
ROLE_HINT
The role hint for the
MarkdownParser Plexus component. |
ROLE, TXT_TYPE, UNKNOWN_TYPE, XML_TYPE
Constructor and Description |
---|
MarkdownParser() |
Modifier and Type | Method and Description |
---|---|
int |
getType()
|
static boolean |
isHtmlComment(org.pegdown.ast.Node node) |
static String |
nodeText(org.pegdown.ast.Node node) |
void |
parse(Reader source,
Sink sink)
Parses the given source model and emits Doxia events into the given sink.
|
doxiaVersion, enableLogging, executeMacro, getBasedir, getLog, getMacroManager, init, isEmitComments, isSecondParsing, parse, parse, setEmitComments, setSecondParsing
public static final String ROLE_HINT
MarkdownParser
Plexus component.protected static final org.pegdown.PegDownProcessor PEGDOWN_PROCESSOR
PegDownProcessor
used to convert Pegdown documents to HTML.public int getType()
AbstractParser
getType
in interface Parser
getType
in class AbstractParser
public void parse(Reader source, Sink sink) throws ParseException
Parser
source
- not null reader that provides the source document.
You could use newReader
methods from ReaderFactory
.sink
- A sink that consumes the Doxia events.ParseException
- if the model could not be parsed.public static boolean isHtmlComment(org.pegdown.ast.Node node)
public static String nodeText(org.pegdown.ast.Node node)
Copyright © 2005–2023 The Apache Software Foundation. All rights reserved.