@Test public void markdownToHtml() { assertEquals("<p>Test line 1 <strong>bold</strong><br />Test second line</p>\n<p>Test new paragraph</p>\n", service.markdownToHtml("Test line 1 **bold**\nTest second line\n\nTest new paragraph")); assertEquals("<p>Test list</p>\n<ul><li>Item 1</li><li>Item 2</li></ul>\n", service.markdownToHtml("Test list\n\n- Item 1\n- Item 2")); assertEquals("<p>Test numbered list</p>\n<ol><li>Item 1</li><li>Item 2</li></ol>\n", service.markdownToHtml("Test numbered list\n\n1. Item 1\n2. Item 2")); assertEquals("<p><a href=\"http: service.markdownToHtml("[Test Link](http: assertEquals("<p><img src=\"https: service.markdownToHtml("![My Image](https: }
public String markdownToHtml(String markdown) { Node node = markdownParser.parse(markdown); String html = htmlRenderer.render(node); return sanitizePolicy.sanitize(html); }
MarkdownService { public String markdownToHtml(String markdown) { Node node = markdownParser.parse(markdown); String html = htmlRenderer.render(node); return sanitizePolicy.sanitize(html); } }
MarkdownService { public String markdownToHtml(String markdown) { Node node = markdownParser.parse(markdown); String html = htmlRenderer.render(node); return sanitizePolicy.sanitize(html); } @Inject private  MarkdownService(PolicyFactory sanitizePolicy, Parser markdownParser, HtmlRenderer htmlRenderer); }
MarkdownService { public String markdownToHtml(String markdown) { Node node = markdownParser.parse(markdown); String html = htmlRenderer.render(node); return sanitizePolicy.sanitize(html); } @Inject private  MarkdownService(PolicyFactory sanitizePolicy, Parser markdownParser, HtmlRenderer htmlRenderer); static MarkdownService withDefaults(); static MarkdownService of(PolicyFactory sanitizePolicy, Parser markdownParser, HtmlRenderer htmlRenderer); String markdownToHtml(String markdown); boolean isSafeMarkdown(String markdown); }
MarkdownService { public String markdownToHtml(String markdown) { Node node = markdownParser.parse(markdown); String html = htmlRenderer.render(node); return sanitizePolicy.sanitize(html); } @Inject private  MarkdownService(PolicyFactory sanitizePolicy, Parser markdownParser, HtmlRenderer htmlRenderer); static MarkdownService withDefaults(); static MarkdownService of(PolicyFactory sanitizePolicy, Parser markdownParser, HtmlRenderer htmlRenderer); String markdownToHtml(String markdown); boolean isSafeMarkdown(String markdown);  }