Java Code Examples for org.commonmark.renderer.html.HtmlWriter#tag()
The following examples show how to use
org.commonmark.renderer.html.HtmlWriter#tag() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MarkdownUtil.java From ml-blog with MIT License | 6 votes |
@Override public void render(Node node) { HtmlWriter html = context.getWriter(); FencedCodeBlock codeBlock = (FencedCodeBlock) node; Map<String,String> attrs = new HashMap<>(); if (!StringUtils.isEmpty(codeBlock.getInfo())) { attrs.put("class","language-" + codeBlock.getInfo()); } html.line(); html.tag("pre"); html.tag("code",attrs); html.tag("ol"); String data = codeBlock.getLiteral(); String[] split = data.split("\n"); for (String s : split) { html.tag("li"); html.text(s + "\n"); html.tag("/li"); } html.tag("/ol"); html.tag("/code"); html.tag("/pre"); html.line(); }
Example 2
Source File: MarkdownUtil.java From ml-blog with MIT License | 6 votes |
@Override public void render(Node node) { HtmlWriter html = context.getWriter(); Image image = (Image) node; Map<String,String> attrs = new HashMap<>(); Map<String,String> attrs2 = new HashMap<>(); attrs.put("href",image.getDestination()); attrs2.put("src",image.getDestination()); html.line(); html.tag("a",attrs); html.tag("image",attrs2); html.tag("/a"); html.line(); }
Example 3
Source File: TableBlockHtmlRenderer.java From js-dossier with Apache License 2.0 | 5 votes |
private void renderBlock(Node node, String tagName) { HtmlWriter writer = context.getWriter(); writer.line(); writer.tag(tagName); renderChildren(node); writer.tag("/" + tagName); writer.line(); }