walokra / markdown-page-generator-plugin

Markdown to HTML Page Generator Maven Plugin
MIT License
56 stars 48 forks source link

Flexmark's renderer options support #58

Closed c47harsis closed 3 years ago

c47harsis commented 3 years ago
  1. Added Flexmark's renderer (https://github.com/vsch/flexmark-java/wiki/Extensions#renderer) options support;
  2. In maven compiler plugin configuration updated source and target versions from 7 to 8.

Fixes walokra/markdown-page-generator-plugin#57

c47harsis commented 3 years ago

Added <flexmarkRendererOptions> in plugin configuration. For example, for my case described in #57:

# Table of content
[TOC levels=2-3]

## First header
### Something
### Something else

## Second header
### Something
### Something else

It converted to this:

<ul>
    <li><a href="#first-header">First header</a>
        <ul>
            <li><a href="#something">Something</a></li>
            <li><a href="#something-else">Something else</a></li>
        </ul>
    </li>
    <li><a href="#second-header">Second header</a>
        <ul>
            <li><a href="#something-1">Something</a></li>
            <li><a href="#something-else-1">Something else</a></li>
        </ul>
    </li>
</ul>
<h2><a href="#first-header" id="first-header"></a>First header</h2>
<h3><a href="#something" id="something"></a>Something</h3>
<h3><a href="#something-else" id="something-else"></a>Something else</h3>
<h2><a href="#second-header" id="second-header"></a>Second header</h2>
<h3><a href="#something-1" id="something-1"></a>Something</h3>
<h3><a href="#something-else-1" id="something-else-1"></a>Something else</h3>

Configuration for this:

<plugin>
    <groupId>com.ruleoftech</groupId>
    <artifactId>markdown-page-generator-plugin</artifactId>
    <version>2.3.1-SNAPSHOT</version>
    <executions>
        <execution>
            <phase>process-resources</phase>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <pegdownExtensions>EXTANCHORLINKS,TOC,FOOTNOTES,FENCED_CODE_BLOCKS</pegdownExtensions>
        <flexmarkParserOptions></flexmarkParserOptions>
          <!--LOOK AT THIS-->
        <flexmarkRendererOptions>HEADER_ID_GENERATOR_RESOLVE_DUPES</flexmarkRendererOptions>
    </configuration>
</plugin>

Flexmark's renderer options you can find here.

P.S. It would be nice to update Flexmark from 0.50.50 to 0.62.2

walokra commented 3 years ago

Thank you for the PR. Looks good.

I'll check it and the possibility to update Flexmark later this week.

rkulyniak commented 3 years ago

Hello @walokra. Are there any updates on this PR? This functionality is very important for us. Please take a look when you have time.

walokra commented 3 years ago

The PR is now merged and it's included on just released version of 2.4.0.