@Override public void getAstExtra(StringBuilder out) { BasedSequence content = getContentChars(); int lines = getContentLines().size(); segmentSpanChars(out, openingMarker, "open"); segmentSpanChars(out, info, "info"); segmentSpan(out, content, "content"); out.append(" lines[").append(lines).append("]"); segmentSpanChars(out, closingMarker, "close"); }
public int getFenceLength() { return getInfo().length(); }
void render(FencedCodeBlock node, NodeRendererContext context, HtmlWriter html) { html.line(); html.srcPosWithTrailingEOL(node.getChars()).withAttr().tag("pre").openPre(); BasedSequence info = node.getInfo(); if (info.isNotNull() && !info.isBlank()) { BasedSequence language = node.getInfoDelimitedByAny(" "); html.attr("class", context.getHtmlOptions().languageClassPrefix + language.unescape()); } else { String noLanguageClass = context.getHtmlOptions().noLanguageClass.trim(); if (!noLanguageClass.isEmpty()) { html.attr("class", noLanguageClass); } } html.srcPosWithEOL(node.getContentChars()).withAttr(CODE_CONTENT).tag("code"); if (codeContentBlock) { context.renderChildren(node); } else { html.text(node.getContentChars().normalizeEOL()); } html.tag("/code"); html.tag("/pre").closePre(); html.lineIf(context.getHtmlOptions().htmlBlockCloseTagEol); }
private void render(FencedCodeBlock node, NodeFormatterContext context, MarkdownWriter markdown) { markdown.blankLine(); CharSequence openingMarker = node.getOpeningMarker(); CharSequence closingMarker = node.getClosingMarker(); char openingMarkerChar = openingMarker.charAt(0); char closingMarkerChar = closingMarker.length() > 0 ? closingMarker.charAt(0) : '\0'; markdown.appendNonTranslating(node.getInfo()); markdown.line(); markdown.appendNonTranslating(node.getContentChars()); } else { if (formatterOptions.fencedCodeMinimizeIndent) { List<BasedSequence> lines = node.getContentLines(); int[] leadColumns = new int[lines.size()]; int minSpaces = Integer.MAX_VALUE; markdown.append(node.getContentChars()); markdown.append(node.getContentChars());
private void render(FencedCodeBlock node, NodeRendererContext context, HtmlWriter html) { BasedSequence info = node.getInfo(); if (info.isNotNull() && !info.isBlank()) { html.line().raw("{code:lang=" + info.unescape() + "}").line(); } else { html.line().raw("{code}").line(); } html.raw(node.getContentChars().normalizeEOL()); html.line().raw("{code}").blankLine(); }
html.srcPosWithTrailingEOL(node.getChars()).withAttr().tag("pre").openPre(); BasedSequence info = node.getInfo(); if (info.isNotNull() && !info.isBlank()) { int space = info.indexOf(' '); html.srcPosWithEOL(node.getContentChars()).withAttr(CODE_CONTENT).tag("code"); if (Parser.FENCED_CODE_CONTENT_BLOCK.getFrom(options)) { context.renderChildren(node);
private void render(final FencedCodeBlock node, final NodeRendererContext context, HtmlWriter html) { final BasedSequence info = node.getInfoDelimitedByAny(options.blockInfoDelimiters); if (options.renderBlockMath && info.equals("math")) { html.line(); html.srcPosWithTrailingEOL(node.getChars()).attr(Attribute.CLASS_ATTR, options.blockMathClass).withAttr().tag("div").line().openPre(); if (codeContentBlock) { context.renderChildren(node); } else { html.text(node.getContentChars().normalizeEOL()); } html.closePre().tag("/div"); html.lineIf(context.getHtmlOptions().htmlBlockCloseTagEol); } else if (options.renderBlockMermaid && info.equals("mermaid")) { html.line(); html.srcPosWithTrailingEOL(node.getChars()).attr(Attribute.CLASS_ATTR, options.blockMermaidClass).withAttr().tag("div").line().openPre(); if (codeContentBlock) { context.renderChildren(node); } else { html.text(node.getContentChars().normalizeEOL()); } html.closePre().tag("/div"); html.lineIf(context.getHtmlOptions().htmlBlockCloseTagEol); } else { context.delegateRender(); } }
html.srcPosWithTrailingEOL( node.getChars() ).withAttr().tag( "pre" ).openPre(); String s = node.getContentChars().normalizeEOL(); while ( !s.isEmpty() && s.charAt( 0 ) == '\n' )
@Override public BasedSequence[] getSegments() { return new BasedSequence[] { openingMarker, info, getContentChars(), closingMarker }; }
private void render(final FencedCodeBlock node, final DocxRendererContext docx) { List<BasedSequence> lines = node.getContentLines(); docx.renderFencedCodeLines(lines); }
void render(FencedCodeBlock node, NodeRendererContext context, HtmlWriter html) { html.line(); html.srcPosWithTrailingEOL(node.getChars()).withAttr().tag("pre").openPre(); BasedSequence info = node.getInfo(); if (info.isNotNull() && !info.isBlank()) { BasedSequence language = node.getInfoDelimitedByAny(" "); html.attr("class", context.getHtmlOptions().languageClassPrefix + language.unescape()); } else { String noLanguageClass = context.getHtmlOptions().noLanguageClass.trim(); if (!noLanguageClass.isEmpty()) { html.attr("class", noLanguageClass); } } html.srcPosWithEOL(node.getContentChars()).withAttr(CODE_CONTENT).tag("code"); if (codeContentBlock) { context.renderChildren(node); } else { html.text(node.getContentChars().normalizeEOL()); } html.tag("/code"); html.tag("/pre").closePre(); html.lineIf(context.getHtmlOptions().htmlBlockCloseTagEol); }
private void render(FencedCodeBlock node, NodeFormatterContext context, MarkdownWriter markdown) { markdown.blankLine(); CharSequence openingMarker = node.getOpeningMarker(); CharSequence closingMarker = node.getClosingMarker(); char openingMarkerChar = openingMarker.charAt(0); char closingMarkerChar = closingMarker.length() > 0 ? closingMarker.charAt(0) : '\0'; markdown.appendNonTranslating(node.getInfo()); markdown.line(); markdown.appendNonTranslating(node.getContentChars()); } else { if (formatterOptions.fencedCodeMinimizeIndent) { List<BasedSequence> lines = node.getContentLines(); int[] leadColumns = new int[lines.size()]; int minSpaces = Integer.MAX_VALUE; markdown.append(node.getContentChars()); markdown.append(node.getContentChars());
private void render(FencedCodeBlock node, NodeRendererContext context, HtmlWriter html) { BasedSequence info = node.getInfo(); if (info.isNotNull() && !info.isBlank()) { html.line().raw("{code:lang=" + info.unescape() + "}").line(); } else { html.line().raw("{code}").line(); } html.raw(node.getContentChars().normalizeEOL()); html.line().raw("{code}").blankLine(); }
@Override public BasedSequence[] getSegments() { return new BasedSequence[] { openingMarker, info, getContentChars(), closingMarker }; }
private void render(FencedCodeBlock node, NodeRendererContext context, HtmlWriter html) { BasedSequence info = node.getInfo(); if (info.isNotNull() && !info.isBlank()) { html.line().raw("{code:lang=" + info.unescape() + "}").line(); } else { html.line().raw("{code}").line(); } html.raw(node.getContentChars().normalizeEOL()); html.line().raw("{code}").blankLine(); }
@Override public void getAstExtra(StringBuilder out) { BasedSequence content = getContentChars(); int lines = getContentLines().size(); segmentSpanChars(out, openingMarker, "open"); segmentSpanChars(out, info, "info"); segmentSpan(out, content, "content"); out.append(" lines[").append(lines).append("]"); segmentSpanChars(out, closingMarker, "close"); }
public int getFenceLength() { return getInfo().length(); }