pom文件添加remark-java的依赖
<dependency>
<groupId>com.kotcrab.remark</groupId>
<artifactId>remark</artifactId>
<version>1.0.0</version>
</dependency>
使用语法
import com.overzealous.remark.Remark;
public static void main(String[] args) {
Remark remark = new Remark();
String htmlInput ="<p><b>测试</b></p><p>cscs</p><p><a href=\"https://www.baidu.com\" target=\"_blank\">百度</a><br></p>";
String markdown = remark.convertFragment(htmlInput);
System.out.println(markdown);
}