当前位置: 首页>>代码示例>>Java>>正文


Java Extensions.FENCED_CODE_BLOCKS属性代码示例

本文整理汇总了Java中org.pegdown.Extensions.FENCED_CODE_BLOCKS属性的典型用法代码示例。如果您正苦于以下问题:Java Extensions.FENCED_CODE_BLOCKS属性的具体用法?Java Extensions.FENCED_CODE_BLOCKS怎么用?Java Extensions.FENCED_CODE_BLOCKS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.pegdown.Extensions的用法示例。


在下文中一共展示了Extensions.FENCED_CODE_BLOCKS属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MarkdownService

public MarkdownService () {
	markdownFileExtensions.add("md");
	markdownFileExtensions.add("txt");
	markdownFileExtensions.add("markdown");
	
	processor = new PegDownProcessor(
			Extensions.AUTOLINKS | Extensions.TABLES
			| Extensions.FENCED_CODE_BLOCKS | Extensions.STRIKETHROUGH
			| Extensions.ATXHEADERSPACE | Extensions.TASKLISTITEMS);
	
	// read style sheet
	InputStream inputStream = MarkdownService.class.getResourceAsStream(STYLE_SHEET_FILE);
	
	StringWriter writer = new StringWriter();
	
	try {
		IOUtils.copy(inputStream, writer, "UTF-8");
		styleSheet = writer.toString();
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:windsource,项目名称:evernote-markdown-sync,代码行数:22,代码来源:MarkdownService.java

示例2: parseDoc

private static void parseDoc(@NotNull String page, @NotNull File outDir) throws IOException {
    outDir.mkdirs();
    String source = CharStreams.toString(
            new InputStreamReader(ParseDocs.class.getResourceAsStream("/pages/" + page + ".md")));
    String toParse;
    if (source.startsWith("#!")) {
        toParse = "\n" + source.substring(source.indexOf("\n"));
    } else {
        toParse = source;
    }
    new DollarParserImpl(new ParserOptions()).parseMarkdown(toParse);
    PegDownProcessor pegDownProcessor = new PegDownProcessor(Extensions.FENCED_CODE_BLOCKS);
    String result = pegDownProcessor.markdownToHtml(toParse);
    Files.write(new File(outDir, page + ".html").toPath(), result.getBytes());
    Files.write(new File(outDir, page + ".md").toPath(), toParse.getBytes());
    System.exit(0);
}
 
开发者ID:sillelien,项目名称:dollar,代码行数:17,代码来源:ParseDocs.java

示例3: process

public String process(String itemContent) {
    itemContent = new MarkdownFootnotesProcessor(itemContent).process();
    ParsedContent parsed = parseOutRawHtml(itemContent);
    PegDownProcessor pegdownProcessor = new PegDownProcessor(
            Extensions.FENCED_CODE_BLOCKS |
                    Extensions.AUTOLINKS |
                    Extensions.STRIKETHROUGH |
                    Extensions.TABLES |
                    Extensions.QUOTES |
                    Extensions.SMARTS
    );
    itemContent = pegdownProcessor.markdownToHtml(parsed.content);
    itemContent = swapInRawHtml(itemContent, parsed);
    return itemContent;
}
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:15,代码来源:Markdown.java

示例4: shouldHighlightMarkdown

@Test
public void shouldHighlightMarkdown() throws IOException {
    PegDownProcessor processor = new PegDownProcessor(Extensions.FENCED_CODE_BLOCKS);
    byte[] bytes = Files.readAllBytes(Paths.get("src/test/resources/markdown", "java1.md"));
    String markdown = new String(bytes, StandardCharsets.UTF_8);
    String html = processor.markdownToHtml(markdown);
    System.out.println(html);
}
 
开发者ID:ops4j,项目名称:org.ops4j.ramler,代码行数:8,代码来源:MarkdownTest.java

示例5: extensions

public static int extensions() {

        int EXT = Extensions.NONE;

        EXT |= Extensions.FENCED_CODE_BLOCKS;
        EXT |= Extensions.TABLES;
        EXT |= Extensions.STRIKETHROUGH;
        // EXT |= Extensions.SMARTS; // Breaks link including a dash -

        return EXT;
    }
 
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:11,代码来源:ToConfluenceSerializer.java

示例6: test

@Test
public void test() throws IOException {
    try {
        PegDownProcessor processor = new PegDownProcessor(Extensions.FENCED_CODE_BLOCKS);
        RootNode rootNode = processor.parseMarkdown(FileUtils.readFileToString(new File("README.tmpl.md")).toCharArray());
        rootNode.accept(new DocTestingVisitor());
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}
 
开发者ID:sillelien,项目名称:dollar-core,代码行数:11,代码来源:DocTest.java

示例7: compile

public static String compile(String src) {
  PegDownProcessor processor = new PegDownProcessor(Extensions.AUTOLINKS | Extensions.FENCED_CODE_BLOCKS);
  String replaced = expandSpaceForLi(src);
  String html = processor.markdownToHtml(replaced);
  String cleanedHtml = Jsoup.clean(html, Whitelist.relaxed());
  return cleanedHtml;
}
 
开发者ID:kamegu,项目名称:git-webapp,代码行数:7,代码来源:Markdown.java

示例8: makeHelpText

private void makeHelpText(ScriptFieldAnswer answer, Pane parent) {

                TextFlow flow = new TextFlow();

                DataType fieldDataType = answer.getField().getDataType();
                if (fieldDataType instanceof DataType.Enumeration) {
                        StringBuilder b = new StringBuilder();
                        String last = "";
                        for (String v : ((DataType.Enumeration)fieldDataType).getValues()) {
                                if (b.length() > 0) {
                                        b.append(", ");
                                }
                                b.append(last);
                                last = v;
                        }
                        if (b.length() > 0) {
                                b.append(" or ");
                        }
                        b.append(last);
                        getJavaFxParent(flow).addChild(new Text("Possible values: " + b + "\n"));
                }
                MarkdownToJavafx mdToFx = new MarkdownToJavafx(this.getJavaFxParent(flow));
                PegDownProcessor mdProcessor = new PegDownProcessor(Extensions.FENCED_CODE_BLOCKS);
                if (answer.getField().getDescription() != null) {
                	RootNode node = mdProcessor.parseMarkdown(answer.getField().getDescription().toCharArray());
                	node.accept(mdToFx);
                }
                parent.getChildren().add(flow);
                flow.setMaxWidth(350);
                //helpText = helpText.trim();
                //helpText.replace('\n', ' ');
                //helpText.replace('\t', ' ');
                
                //Text help = new Text(answer.getField().getDescription());
                //RootNode node = mdProcessor.parseMarkdown(answer.getField().getDescription().toCharArray());
                ////help.getStyleClass().add("help");
                
                //return help;
        }
 
开发者ID:daisy,项目名称:pipeline-gui,代码行数:39,代码来源:GridPaneHelper.java

示例9: parseMarkdown

@Override
@NotNull
public Value parseMarkdown(@NotNull String source) {
    PegDownProcessor processor = new PegDownProcessor(Extensions.FENCED_CODE_BLOCKS);
    RootNode rootNode = processor.parseMarkdown(source.toCharArray());
    rootNode.accept(new CodeExtractionVisitor());
    return $();
}
 
开发者ID:sillelien,项目名称:dollar,代码行数:8,代码来源:DollarParserImpl.java

示例10: extensionFor

private int extensionFor(String name) {
      int extension = Extensions.NONE;
if (name.equals("HARDWRAPS")) {
	extension = Extensions.HARDWRAPS;
      } else if (name.equals("AUTOLINKS")) {
          extension = Extensions.AUTOLINKS;
      } else if (name.equals("FENCED_CODE_BLOCKS")) {
          extension = Extensions.FENCED_CODE_BLOCKS;
      } else if (name.equals("DEFINITIONS")) {
          extension = Extensions.DEFINITIONS;
      } else if (name.equals("ABBREVIATIONS")) {
          extension = Extensions.ABBREVIATIONS;
      } else if (name.equals("QUOTES")) {
          extension = Extensions.QUOTES;
      } else if (name.equals("SMARTS")) {
          extension = Extensions.SMARTS;
      } else if (name.equals("SMARTYPANTS")) {
          extension = Extensions.SMARTYPANTS;
      } else if (name.equals("SUPPRESS_ALL_HTML")) {
          extension = Extensions.SUPPRESS_ALL_HTML;
      } else if (name.equals("SUPPRESS_HTML_BLOCKS")) {
          extension = Extensions.SUPPRESS_HTML_BLOCKS;
      } else if (name.equals("SUPPRESS_INLINE_HTML")) {
          extension = Extensions.SUPPRESS_INLINE_HTML;
      } else if (name.equals("TABLES")) {
          extension = Extensions.TABLES;
      } else if (name.equals("WIKILINKS")) {
          extension = Extensions.WIKILINKS;
      } else if (name.equals("ANCHORLINKS")) {
          extension = Extensions.ANCHORLINKS;
      } else if (name.equals("STRIKETHROUGH")) {
          extension = Extensions.STRIKETHROUGH;
      }else if (name.equals("ATXHEADERSPACE")) {
          extension = Extensions.ATXHEADERSPACE;
      }else if (name.equals("FORCELISTITEMPARA")) {
          extension = Extensions.FORCELISTITEMPARA;
      }else if (name.equals("RELAXEDHRULES")) {
          extension = Extensions.RELAXEDHRULES;
      }else if (name.equals("TASKLISTITEMS")) {
          extension = Extensions.TASKLISTITEMS;
      }else if (name.equals("EXTANCHORLINKS")) {
          extension = Extensions.EXTANCHORLINKS;
      } else if (name.equals("ALL")) {
          extension = Extensions.ALL;
      } else if (name.equals("ALL_OPTIONALS")) {
          extension = Extensions.ALL_OPTIONALS;
      } else if (name.equals("ALL_WITH_OPTIONALS")) {
          extension = Extensions.ALL_WITH_OPTIONALS;
      }
      return extension;
  }
 
开发者ID:ghaseminya,项目名称:jbake-rtl-jalaali,代码行数:51,代码来源:MarkdownEngine.java

示例11: PluginParser

public PluginParser() {
    super(Extensions.FENCED_CODE_BLOCKS | Extensions.WIKILINKS, 1000L, Parser.DefaultParseRunnerProvider);
}
 
开发者ID:nicolaschriste,项目名称:docdown,代码行数:3,代码来源:PluginParser.java

示例12: parseDescriptionFromMarkdown

private static VBox parseDescriptionFromMarkdown(final String markdown) {

		final VBox result = new VBox();
		final PegDownProcessor processor = new PegDownProcessor(Extensions.STRIKETHROUGH | Extensions.FENCED_CODE_BLOCKS);

		final RootNode rootNode = processor.parseMarkdown(markdown.toCharArray());

		// PanelUtil.visit(rootNode, "");

		final MarkdownVisitor visitor = new MarkdownVisitor();

		visitor.pushNode(result);

		rootNode.accept(visitor);

		result.getStylesheets().add("/styles/markdown.css");
		result.setMaxWidth(200);
		result.layout();

		return result;
	}
 
开发者ID:JanStrauss,项目名称:skadi,代码行数:21,代码来源:PanelUtil.java

示例13: exec

@Override
public Object exec(@SuppressWarnings("rawtypes") List arguments) throws TemplateModelException
{
    if (arguments.size() != 1)
    {
        throw new TemplateModelException("Error, method expects one argument (String)");
    }
    SimpleScalar freemarkerArg = (SimpleScalar) arguments.get(0);
    String markdownSource = freemarkerArg.getAsString();

    SoftReference<String> cachedResult = cache.get(markdownSource);
    String cachedResultString;
    if (cachedResult != null && (cachedResultString = cachedResult.get()) != null)
    {
        return cachedResultString;
    }

    try
    {
        // build the plugins object with our extensions
        PegDownPlugins plugins = PegDownPlugins.builder().build();
        PegDownProcessor processor = new PegDownProcessor(Extensions.FENCED_CODE_BLOCKS, MAX_PARSING_TIME_MILLIS, plugins);

        // build the node and then serialize it so that we can make sure the serializer uses our plugins
        RootNode outputNode = processor.parseMarkdown(markdownSource.toCharArray());

        // Our plugin is also a serializer, so build a plugins list for serialization as well
        List<ToHtmlSerializerPlugin> serializerPlugins = new ArrayList<>(1);

        ToHtmlSerializer serializer = new ToHtmlSerializerExtended(new LinkRenderer(), Collections.<String, VerbatimSerializer> emptyMap(),
                    serializerPlugins);
        String result = serializer.toHtml(outputNode);
        cache.put(markdownSource, new SoftReference<>(result));
        return result;
    }
    catch (Throwable t)
    {
        LOG.log(Level.WARNING, "Failed to parse markdown due to: " + t.getMessage() + " markdown source: " + markdownSource, t);
        // Return the unformatted markdown, as this is better than failing the report completely.
        return markdownSource;
    }
}
 
开发者ID:windup,项目名称:windup,代码行数:42,代码来源:MarkdownToHtmlMethod.java


注:本文中的org.pegdown.Extensions.FENCED_CODE_BLOCKS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。