【问题标题】:Maven site generation using advanced Markdown?使用高级 Markdown 生成 Maven 站点?
【发布时间】:2020-07-15 00:32:04
【问题描述】:

我们在 Maven generated site 中使用 Markdown。奇迹般有效。 AFAIK 该插件在后台使用Flexmark,它支持Admonition extensions

我们也想使用它们,信息框对文档很有帮助。我们在pom.xml 中的站点配置如下所示:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-site-plugin</artifactId>
    <version>3.8.2</version>
</plugin>

我们如何配置它以识别额外的降价?

【问题讨论】:

    标签: maven markdown maven-site-plugin doxia flexmark


    【解决方案1】:

    这个问题有点老了,但我一直在尝试解决这个问题,以便将 Gitlab 扩展用于数学方程式,简短的回答是我认为你不能开箱即用。

    maven-site-plugin 使用 doxia-module-markdown 模块进行降价,该模块在内部使用 Flexmark,但它预先配置了用于此目的的扩展。

    这是代码的link 和确切的 sn-p 来自

    // Initialize the Flexmark parser and renderer, once and for all
    static
    {
        MutableDataSet flexmarkOptions = new MutableDataSet();
    
        // Enable the extensions that we used to have in Pegdown
        flexmarkOptions.set( com.vladsch.flexmark.parser.Parser.EXTENSIONS, Arrays.asList(
                EscapedCharacterExtension.create(),
                AbbreviationExtension.create(),
                AutolinkExtension.create(),
                DefinitionExtension.create(),
                TypographicExtension.create(),
                TablesExtension.create(),
                WikiLinkExtension.create(),
                StrikethroughExtension.create()
        ) );
    
    // ...
    }
    

    我认为您可以分叉这个项目,添加您需要的扩展,并将其作为依赖项添加到 maven-site-plugin,它可能会像这样工作:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.8.2</version>
        <dependencies>
            <dependency>
                <groupId>${my-forked-groupId}</groupId>
                <artifactId>${my-forked-artifactId}</artifactId>
                <version>${my-forked-version}</version>
            </dependency>
        </dependencies>
    </plugin>
    

    我认为这不太理想,我可能会探索其他(非 maven)选项以获得我正在寻找的结果,但可能仍会在第二天左右尝试这个,如果我得到如果其他人可以从中受益,我会发送一个代码链接。

    【讨论】:

    • 所以我确实尝试了我上面提到的,fork 存储库并将 Gitlab 扩展添加到 flexmakrOptions,然后将依赖项更新到 maven-site-plugin。这实际上效果很好。
    猜你喜欢
    • 1970-01-01
    • 2011-03-20
    • 1970-01-01
    • 2011-07-28
    • 1970-01-01
    • 2013-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多