-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target/ | ||
|
||
.idea/ | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Flexmark (Markdown) Formatter for Jenkins | ||
========================================= | ||
|
||
This Jenkins plugin adds a Markup Formatter that can process Markdown | ||
using Flexmark. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<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/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.jenkins-ci.plugins</groupId> | ||
<artifactId>plugin</artifactId> | ||
<version>4.2</version> | ||
</parent> | ||
|
||
<groupId>de.aservo</groupId> | ||
<artifactId>flexmark-formatter-jenkins-plugin</artifactId> | ||
<version>0.1</version> | ||
<packaging>hpi</packaging> | ||
|
||
<developers> | ||
<developer> | ||
<name>Patrick Hobusch</name> | ||
<email>[email protected]</email> | ||
<organization>ASERVO Software GmbH</organization> | ||
<organizationUrl>https://www.aservo.com</organizationUrl> | ||
</developer> | ||
</developers> | ||
|
||
<properties> | ||
<java.level>8</java.level> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.vladsch.flexmark</groupId> | ||
<artifactId>flexmark</artifactId> | ||
<version>0.62.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.vladsch.flexmark</groupId> | ||
<artifactId>flexmark-util</artifactId> | ||
<version>0.62.2</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<repositories> | ||
<repository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package de.aservo.jenkins; | ||
|
||
import com.vladsch.flexmark.html.HtmlRenderer; | ||
import com.vladsch.flexmark.parser.Parser; | ||
import com.vladsch.flexmark.util.ast.Node; | ||
import com.vladsch.flexmark.util.data.MutableDataSet; | ||
import hudson.Extension; | ||
import hudson.markup.MarkupFormatter; | ||
import hudson.markup.MarkupFormatterDescriptor; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.io.IOException; | ||
import java.io.Writer; | ||
|
||
public class FlexmarkFormatter extends MarkupFormatter { | ||
|
||
@DataBoundConstructor | ||
public FlexmarkFormatter() { | ||
} | ||
|
||
@Override | ||
public void translate( | ||
final String markup, | ||
final Writer output) throws IOException { | ||
|
||
final MutableDataSet options = new MutableDataSet(); | ||
final Parser parser = Parser.builder(options).build(); | ||
final HtmlRenderer renderer = HtmlRenderer.builder(options).build(); | ||
|
||
final Node document = parser.parse(markup); | ||
output.write(renderer.render(document)); | ||
} | ||
|
||
@Extension | ||
public static class DescriptorImpl extends MarkupFormatterDescriptor { | ||
|
||
@Nonnull | ||
@Override | ||
public String getDisplayName() { | ||
return "Flexmark (Markdown)"; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?jelly escape-by-default='true'?> | ||
<div> | ||
This plugin adds a Markup Formatter than can process Markdown using Flexmark | ||
</div> |