com.vladsch.flexmark.ext.wikilink.WikiLinkExtension Java Examples

The following examples show how to use com.vladsch.flexmark.ext.wikilink.WikiLinkExtension. 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: WikiFormatter.java    From webdsl with Apache License 2.0 6 votes vote down vote up
private static synchronized HtmlRenderer getHTMLRenderer( String rootUrl, boolean hardwrapsEnabled ){
  	if(!currentRootUrl.equals(rootUrl) && rootUrl != null ) {
	currentRootUrl = rootUrl;
	RENDERER_HW = null;
	RENDERER_NOHW = null;
	String linkPrefix = rootUrl + "/";
	optionsHardWraps.set(WikiLinkExtension.LINK_PREFIX, linkPrefix);
	optionsNoHardWraps.set(WikiLinkExtension.LINK_PREFIX, linkPrefix);
}
  	
  	if(hardwrapsEnabled){
  		if(RENDERER_HW == null){    			
  			RENDERER_HW = HtmlRenderer.builder( optionsHardWraps ).build();
  		}
  		return RENDERER_HW;
  	} else {
  	    if(RENDERER_NOHW == null){
  	    	RENDERER_NOHW = HtmlRenderer.builder( optionsNoHardWraps ).build();
  	    }
  	    return RENDERER_NOHW;
  	}
  }
 
Example #2
Source File: FlexmarkParser.java    From zeppelin with Apache License 2.0 5 votes vote down vote up
public FlexmarkParser() {
  MutableDataSet options = new MutableDataSet();
  options.set(Parser.EXTENSIONS, Arrays.asList(StrikethroughExtension.create(),
      TablesExtension.create(),
      UMLExtension.create(),
      AutolinkExtension.create(),
      WikiLinkExtension.create(),
      TypographicExtension.create()));
  options.set(HtmlRenderer.SOFT_BREAK, "<br />\n");
  parser = Parser.builder(options).build();
  renderer = HtmlRenderer.builder(options).build();
}
 
Example #3
Source File: PMarkdownOptions.java    From jphp with Apache License 2.0 4 votes vote down vote up
@Signature
public PMarkdownOptions addWikiLinkExtension(@Arg(type = HintType.ARRAY) @Optional("null") Memory options) {
    parserExtensions.add(WikiLinkExtension.create());

    Memory linkPrefix = options.valueOfIndex("linkPrefix");
    if (linkPrefix.isNotNull()) {
        this.options.set(WikiLinkExtension.LINK_PREFIX, linkPrefix.toString());
    }

    Memory linkPrefixAbsolute = options.valueOfIndex("linkPrefixAbsolute");
    if (linkPrefixAbsolute.isNotNull()) {
        this.options.set(WikiLinkExtension.LINK_PREFIX_ABSOLUTE, linkPrefixAbsolute.toString());
    }

    Memory imagePrefix = options.valueOfIndex("imagePrefix");
    if (imagePrefix.isNotNull()) {
        this.options.set(WikiLinkExtension.IMAGE_PREFIX, imagePrefix.toString());
    }

    Memory imagePrefixAbsolute = options.valueOfIndex("imagePrefixAbsolute");
    if (imagePrefixAbsolute.isNotNull()) {
        this.options.set(WikiLinkExtension.IMAGE_PREFIX_ABSOLUTE, imagePrefixAbsolute.toString());
    }

    Memory imageFileExtension = options.valueOfIndex("imageFileExtension");
    if (imageFileExtension.isNotNull()) {
        this.options.set(WikiLinkExtension.IMAGE_FILE_EXTENSION, imageFileExtension.toString());
    }

    Memory imageLinks = options.valueOfIndex("imageLinks");
    if (imageLinks.isNotNull()) {
        this.options.set(WikiLinkExtension.IMAGE_LINKS, imageLinks.toBoolean());
    }

    Memory disableRendering = options.valueOfIndex("disableRendering");
    if (disableRendering.isNotNull()) {
        this.options.set(WikiLinkExtension.DISABLE_RENDERING, disableRendering.toBoolean());
    }

    Memory allowAnchors = options.valueOfIndex("allowAnchors");
    if (allowAnchors.isNotNull()) {
        this.options.set(WikiLinkExtension.ALLOW_ANCHORS, allowAnchors.toBoolean());
    }

    Memory allowInlines = options.valueOfIndex("allowInlines");
    if (allowInlines.isNotNull()) {
        this.options.set(WikiLinkExtension.ALLOW_INLINES, allowInlines.toBoolean());
    }

    return this;
}