Examples of parseMarkdown()


Examples of org.pegdown.PegDownProcessor.parseMarkdown()

   * @throws java.text.ParseException
   */
  public static String transformMarkdown(String markdown, LinkRenderer linkRenderer) {
    try {
      PegDownProcessor pd = new PegDownProcessor(ALL & ~SMARTYPANTS);
      RootNode astRoot = pd.parseMarkdown(markdown.toCharArray());
      return new WorkaroundHtmlSerializer(linkRenderer == null ? new LinkRenderer() : linkRenderer).toHtml(astRoot);
    } catch (ParsingTimeoutException e) {
      return null;
    }
  }
View Full Code Here

Examples of org.pegdown.PegDownProcessor.parseMarkdown()

   * @throws java.text.ParseException
   */
  public static String transformMarkdown(String markdown, LinkRenderer linkRenderer) {
    try {
      PegDownProcessor pd = new PegDownProcessor(ALL & ~SMARTYPANTS);
      RootNode astRoot = pd.parseMarkdown(markdown.toCharArray());
      return new WorkaroundHtmlSerializer(linkRenderer == null ? new LinkRenderer() : linkRenderer).toHtml(astRoot);
    } catch (ParsingTimeoutException e) {
      return null;
    }
  }
View Full Code Here

Examples of org.pegdown.PegDownProcessor.parseMarkdown()

    }

    public void runTestWithExtensions(String baseName, int extensions) throws IOException {
        String source = getTestResourceAsString(baseName + ".md");
        PegDownProcessor processor = new PegDownProcessor(extensions);
        RootNode rootNode = processor.parseMarkdown(source.toCharArray());

        assertThat("rootNode", rootNode, notNullValue());

        final int totalLength = source.length();
        MarkdownTokenListBuilder builder = new MarkdownTokenListBuilder(totalLength);
View Full Code Here

Examples of org.pegdown.PegDownProcessor.parseMarkdown()

        int inputLength = markdownSource.length;

        List<MarkdownToken> tokens;
        try {
            RootNode rootNode = markdownProcessor.parseMarkdown(markdownSource);

            MarkdownTokenListBuilder builder = new MarkdownTokenListBuilder(inputLength);
            MarkdownLexerVisitor visitor = new MarkdownLexerVisitor(builder);
            rootNode.accept(visitor);
            tokens = builder.build();
View Full Code Here

Examples of org.pegdown.PegDownProcessor.parseMarkdown()

        try {
            PegDownProcessor markdownProcessor = new PegDownProcessor(markdownOptions.getExtensionsValue());
            final boolean resolveImageUrls = renderOptions.contains(RenderOption.RESOLVE_IMAGE_URLS);
            final boolean resolveLinkUrls = renderOptions.contains(RenderOption.RESOLVE_LINK_URLS);
            if (resolveImageUrls || resolveLinkUrls) {
                RootNode rootNode = markdownProcessor.parseMarkdown(sourceText.toCharArray());
                FileObject sourceFile = context.getPrimaryFile();
                final PreviewSerializer htmlSerializer
                        = new PreviewSerializer(sourceFile.toURL(), resolveImageUrls, resolveLinkUrls);
                bodyText = htmlSerializer.toHtml(rootNode);
            }
View Full Code Here

Examples of org.pegdown.PegDownProcessor.parseMarkdown()

                final PreviewSerializer htmlSerializer
                        = new PreviewSerializer(sourceFile.toURL(), resolveImageUrls, resolveLinkUrls);
                bodyText = htmlSerializer.toHtml(rootNode);
            }
            else {
                RootNode rootNode = markdownProcessor.parseMarkdown(sourceText.toCharArray());
                final ExportSerializer htmlSerializer
                        = new ExportSerializer(new LinkRenderer());
                bodyText = htmlSerializer.toHtml(rootNode);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.