maven site plugin - Getting doxia-module-markdown to rewrite *.md links -


my goal generate site documentation browsable within github, i've written bunch of markdown pages.

i'm using maven-site-plugin doxia-module-markdown generate project documentation.

the problem i'm running links of form [foo](foo.md) show in generated html <a href="foo.md">foo</a>, not <a href="foo.html">foo</a>.

changing link point foo.html make things unbrowseable github, , seems me .md.html mapping integral how html generation works, link rewriting should happening here.

below minimal case repro produces following output me

am missing configuration option relative link rewriting apply source file path target file path translation?

the translated html contains .md links.

$ mvn clean site && cat target/site/a.html | grep -i banana ... <p>&#x2018;a&#x2019; apple, <a href="b.md">&#x2018;b&#x2019;</a> banana.</p> 

pom.xml

<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">   <modelversion>4.0.0</modelversion>    <groupid>foo</groupid>   <artifactid>bar</artifactid>   <packaging>jar</packaging>   <version>1-snapshot</version>    <name>foo</name>   <description>   tests link rewriting using doxia markdown module.   </description>   <url>https://example.com/</url>  <!-- should not affect relative urls -->    <build>     <plugins>       <plugin>         <groupid>org.apache.maven.plugins</groupid>         <artifactid>maven-site-plugin</artifactid>         <version>3.5</version>         <dependencies>           <dependency>             <groupid>org.apache.maven.doxia</groupid>             <artifactid>doxia-module-markdown</artifactid>             <version>1.7</version>           </dependency>         </dependencies>       </plugin>       <plugin>         <groupid>org.apache.maven.plugins</groupid>         <artifactid>maven-project-info-reports-plugin</artifactid>         <version>2.8.1</version>       </plugin>     </plugins>   </build> </project> 

site.xml

<?xml version="1.0" encoding="iso-8859-1"?> <project>   <skin>     <groupid>org.apache.maven.skins</groupid>     <artifactid>maven-fluido-skin</artifactid>     <version>1.5</version>   </skin>    <body>     <links>     </links>      <menu name="docs">       <item name="a" href="a.html"/>       <item name="b" href="b.html"/>     </menu>      <menu ref="reports"/>      <menu ref="modules"/>      <menu ref="parent"/>   </body> </project> 

a.md

#  'a' apple, ['b'](b.md) banana. 

b.md

# b  ['a'](a.md) apple, 'b' banana. 

markdown-page-generator-plugin provides transformrelativemarkdownlinks option transform relative url suffix ".md" ".html" if option true. (default: false.)

setup:

  • put markdown files processed doxia-module-markdown in /src/site/markdown/
  • put markdown files processed markdown-page-generator-plugin in differently named folder such /src/site/markdown_/
  • put html code added doxia-module-markdown header.html , footer.html
  • configure markdown-page-generator-plugin include header.html , footer.html
  • configure markdown-page-generator-plugin add add processed file same target folder used doxia-module-markdown

adapt pom.xml:

<plugin>   <groupid>org.apache.maven.plugins</groupid>   <artifactid>maven-site-plugin</artifactid>   <version>3.6</version>   <dependencies>     <!-- processes ${project.basedir}/src/site/markdown/ -->     <dependency>       <groupid>org.apache.maven.doxia</groupid>       <artifactid>doxia-module-markdown</artifactid>       <version>1.7</version>     </dependency>   </dependencies> </plugin> <plugin>   <groupid>com.ruleoftech</groupid>   <artifactid>markdown-page-generator-plugin</artifactid>   <version>0.10</version>   <executions>     <execution>       <phase>process-sources</phase>       <goals>         <goal>generate</goal>       </goals>     </execution>   </executions>   <configuration>     <inputdirectory>${project.basedir}/src/site/markdown_/</inputdirectory>     <outputdirectory>${project.build.directory}/site/</outputdirectory>      <!-- copy other /markdown_/* directories -->     <copydirectories>images_,quickstart_files</copydirectories>      <!-- put doxia-module-markdown additional html in these header & footer files -->     <headerhtmlfile>${project.basedir}/src/site/markdown_/html/header.html</headerhtmlfile>     <footerhtmlfile>${project.basedir}/src/site/markdown_/html/footer.html</footerhtmlfile>      <!-- transform relative url suffix ".md" ".html" -->     <transformrelativemarkdownlinks>true</transformrelativemarkdownlinks>      <pegdownextensions>anchorlinks,hardwraps,autolinks,tables,fenced_code_blocks</pegdownextensions>   </configuration> </plugin> 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -