开源软件名称(OpenSource Name):Steppschuh/Java-Markdown-Generator开源软件地址(OpenSource Url):https://github.com/Steppschuh/Java-Markdown-Generator开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):Java Markdown GeneratorSimple to use Java library to generate beautiful markdown. UsageIntegrationGradleYou can get snapshot and release builds from JitPack: repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compile 'com.github.Steppschuh:Java-Markdown-Generator:master-SNAPSHOT'
} Alternatively, release builds are also available on Bintray: repositories {
maven { url 'http://dl.bintray.com/steppschuh/Markdown-Generator' }
}
dependencies {
compile 'net.steppschuh.markdowngenerator:markdowngenerator:1.3.2'
} Maven<dependency>
<groupId>net.steppschuh.markdowngenerator</groupId>
<artifactId>markdowngenerator</artifactId>
<version>1.3.2</version>
</dependency> JARYou can download the latest .jar files from GitHub or Bintray. ExamplesMost Markdown elements have static convenience methods in the Emphasis@Test
public void example() throws Exception {
StringBuilder sb = new StringBuilder()
.append(new Text("I am normal")).append("\n")
.append(new BoldText("I am bold")).append("\n")
.append(new ItalicText("I am italic")).append("\n")
.append(new StrikeThroughText("I am strike-through"));
System.out.println(sb);
} Output:
Headings@Test
public void example() throws Exception {
StringBuilder sb = new StringBuilder()
.append(new Heading("Heading with level 1", 1)).append("\n")
.append(new Heading("Heading with level 2", 2)).append("\n")
.append(new Heading("Heading with level 3", 3)).append("\n")
.append(new Heading("Heading with level 4", 4)).append("\n")
.append(new Heading("Heading with level 5", 5)).append("\n")
.append(new Heading("Heading with level 6", 6));
System.out.println(sb);
} Output:
Rules@Test
public void example() throws Exception {
System.out.println(new HorizontalRule());
System.out.println(new HorizontalRule(20, HorizontalRule.ASTERISK));
} Output:
Images@Test
public void example() throws Exception {
String text = "I am an image";
String url = "https://dummyimage.com/300";
System.out.println(new Image(text, url));
} Output:
Lists@Test
public void example() throws Exception {
List<Object> items = Arrays.asList(
"Items can be anything",
new Date(0),
1337
);
System.out.println(new UnorderedList<>(items));
} Output:
Tasks@Test
public void example() throws Exception {
List<TaskListItem> items = Arrays.asList(
new TaskListItem("Task 1", true),
new TaskListItem("Task 2", false),
new TaskListItem("Task 3")
);
System.out.println(new TaskList(items));
} Output:
Tables@Test
public void example() throws Exception {
Table.Builder tableBuilder = new Table.Builder()
.withAlignments(Table.ALIGN_RIGHT, Table.ALIGN_LEFT)
.withRowLimit(7)
.addRow("Index", "Boolean");
for (int i = 1; i <= 20; i++) {
tableBuilder.addRow(i, Math.random() > 0.5);
}
System.out.println(tableBuilder.build());
} Output:
Code@Test
public void example() throws Exception {
String code = "// notice this new line\n" +
"System.out.println(\"Hello\");";
System.out.println(new CodeBlock(code, "Java"));
} Output:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论