You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Elliot Metsger <em...@gmail.com> on 2016/08/26 02:26:53 UTC

Configuring the Doxia MarkdownParser

Hi everyone,

I'm using Doxia 1.7 with maven-site-plugin 3.5.1 to parse Markdown
(doxia-module-markdown appears to use pegdown 1.2.1).

I have a use case where I'd like to pass additional options to the
PegDownProcessor that is constructed by MarkdownParser.

In MarkdownParser, the PegDownProcessor is initialized:

    protected static final PegDownProcessor PEGDOWN_PROCESSOR =
        new PegDownProcessor( Extensions.ALL & ~Extensions.HARDWRAPS,
Long.MAX_VALUE );

but I'd like to be able to disable the AUTOLINKS extension like so:

    protected static final PegDownProcessor PEGDOWN_PROCESSOR =
        new PegDownProcessor( Extensions.ALL & ~Extensions.HARDWRAPS &
~Extensions.AUTOLINKS, Long.MAX_VALUE );

I'd like to submit a PR which would allow for a developer to configure the
options supplied to the PegDownProcessor, but before I get started I wanted
to ask the developer community about a recommended approach.

Based on my cursory examination of Doxia, this doesn't seem to be supported
at the API level.  For example, there doesn't seem to be a general way to
pass parser implementation configuration directives from the Doxia API to
ParserModules or Parsers.  Updating the API to support this may be a bit
more than I am able to commit to.

Is there some other way that the MarkdownParser could obtain implementation
configuration information?

For example, could the MarkdownParser be injected with a configuration
object, and have it configure the PegDownProcessor accordingly?  And could
this be accommodated outside of the Doxia API, yet still allow a developer
to configure the MarkdownParser at runtime (like in a Maven
<plugin>/<configuration>, or via Maven <properties>)?

Many thanks for your guidance!
Elliot