Solved
Convert HTML to Markdown
How can I convert HTML to Markdown in Java? I came across Flexmark-osgi, but it converts markdown to HTML.
How can I convert HTML to Markdown in Java? I came across Flexmark-osgi, but it converts markdown to HTML.
Hi @shaheena_sheikh ,
You can use the third-party dependency
com.vladsch.flexmark
by bundling it in the OSGi Bundle using the bnd-maven-plugin. That ways the dependency would be available as OSGi bundle.
eg :
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>${bnd.version}</version>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd>
<![CDATA[
Bundle-Category: ${componentGroupName}
# export all versioned packages except for conditional ones (https://github.com/bndtools/bnd/issues/3721#issuecomment-579026778)
-exportcontents: ${packages;VERSIONED}
# adding conditional packages
-conditionalpackage: com.vladsch.flexmark.html2md.converter.*,com.vladsch.flexmark.*,org.jsoup.*,javax.annotation.meta;
# reproducible builds (https://github.com/bndtools/bnd/issues/3521)
-noextraheaders: true
-snapshot: SNAPSHOT
Bundle-DocURL:
-plugin org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin
-plugin org.apache.sling.bnd.models.ModelsScannerPlugin
]]>
</bnd>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.caconfig.bnd-plugin</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.bnd.models</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>scriptingbundle-maven-plugin</artifactId>
<version>0.5.0</version>
</dependency>
</dependencies>
</plugin>
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.