-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from SBI-/master
Correctly display tables in rich hover and improve styling
- Loading branch information
Showing
12 changed files
with
782 additions
and
57 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
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
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
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
22 changes: 20 additions & 2 deletions
22
plugin/src/main/java/org/jazzcommunity/GitConnectorService/html/MarkdownParser.java
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 |
---|---|---|
@@ -1,17 +1,35 @@ | ||
package org.jazzcommunity.GitConnectorService.html; | ||
|
||
import org.commonmark.Extension; | ||
import org.commonmark.node.Node; | ||
import org.commonmark.parser.Parser; | ||
import org.commonmark.renderer.html.HtmlRenderer; | ||
import org.commonmark.ext.gfm.tables.TablesExtension; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class MarkdownParser { | ||
public static String toHtml(String markdown) { | ||
if (markdown == null) { | ||
return ""; | ||
} | ||
Parser parser = Parser.builder().build(); | ||
|
||
List<Extension> extensions = Arrays.asList(TablesExtension.create()); | ||
|
||
Parser parser = Parser | ||
.builder() | ||
.extensions(extensions) | ||
.build(); | ||
|
||
Node document = parser.parse(markdown); | ||
HtmlRenderer renderer = HtmlRenderer.builder().build(); | ||
|
||
HtmlRenderer renderer = HtmlRenderer | ||
.builder() | ||
.extensions(extensions) | ||
.build(); | ||
|
||
|
||
return renderer.render(document); | ||
} | ||
} |
Oops, something went wrong.