本文整理汇总了Java中com.vladsch.flexmark.Extension类的典型用法代码示例。如果您正苦于以下问题:Java Extension类的具体用法?Java Extension怎么用?Java Extension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Extension类属于com.vladsch.flexmark包,在下文中一共展示了Extension类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: MarkdownCompiler
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
@Inject
public MarkdownCompiler(Set<Extension> extensionSet, Set<MutableDataSet> injectedOptions) {
super(900);
MutableDataSet options = new MutableDataSet();
options.set(HtmlRenderer.GENERATE_HEADER_ID, true);
options.set(HtmlRenderer.RENDER_HEADER_ID, true);
options.set(Parser.EXTENSIONS, extensionSet);
for(MutableDataSet injectedOption : injectedOptions) {
options.setAll(injectedOption);
}
parser = Parser.builder(options).build();
renderer = HtmlRenderer.builder(options).build();
}
开发者ID:JavaEden,项目名称:Orchid,代码行数:18,代码来源:MarkdownCompiler.java
示例2: addExtension
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public void addExtension(Extension extension) {
List<Extension> extensions = getExtensions();
if(!containsExtension(extension)) {
Collections.addAll(extensions, extension);
setExtensions(extensions);
}
}
开发者ID:jdesive,项目名称:textmd,代码行数:8,代码来源:MarkdownParser.java
示例3: addExtension
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
protected void addExtension(final MarkdownParser markdownParser, Extension extension) {
List<Extension> extensions = markdownParser.getExtensions();
if(isSelected() && !extensions.contains(extension)) {
extensions.add(extension);
}else if(extensions.contains(extension)) {
extensions.remove(extension);
}
markdownParser.setExtensions(extensions);
}
开发者ID:jdesive,项目名称:textmd,代码行数:10,代码来源:MdExtensionMenuItem.java
示例4: configure
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
@Override
protected void configure() {
super.configure();
bind(WicketServlet.class).to(DefaultWicketServlet.class);
bind(WicketFilter.class).to(DefaultWicketFilter.class);
bind(WebSocketPolicy.class).toInstance(WebSocketPolicy.newServerPolicy());
bind(EditSupportRegistry.class).to(DefaultEditSupportRegistry.class);
bind(WebSocketManager.class).to(DefaultWebSocketManager.class);
contribute(CommitMessageTransformer.class, PatternCommitMessageTransformer.class);
contributeFromPackage(EditSupport.class, EditSupport.class);
bind(WebApplication.class).to(GitPlexWebApplication.class);
bind(Application.class).to(GitPlexWebApplication.class);
bind(AvatarManager.class).to(DefaultAvatarManager.class);
bind(WebSocketManager.class).to(DefaultWebSocketManager.class);
contributeFromPackage(EditSupport.class, EditSupportLocator.class);
bind(CommitIndexedBroadcaster.class);
contributeFromPackage(DiffRenderer.class, DiffRenderer.class);
contributeFromPackage(BlobRendererContribution.class, BlobRendererContribution.class);
contribute(Extension.class, new EmojiExtension());
contribute(Extension.class, new SourcePositionTrackExtension());
contribute(HtmlTransformer.class, new MentionTransformer());
contribute(HtmlTransformer.class, new PullRequestTransformer());
contribute(ResourcePackScopeContribution.class, new ResourcePackScopeContribution() {
@Override
public Collection<Class<?>> getResourcePackScopes() {
return Lists.newArrayList(WebModule.class);
}
});
contribute(ExpectedExceptionContribution.class, new ExpectedExceptionContribution() {
@SuppressWarnings("unchecked")
@Override
public Collection<Class<? extends Exception>> getExpectedExceptionClasses() {
return Sets.newHashSet(ConstraintViolationException.class, EntityNotFoundException.class,
ObjectNotFoundException.class, StaleStateException.class, UnauthorizedException.class,
GitException.class, PageExpiredException.class, StalePageException.class);
}
});
bind(UrlManager.class).to(DefaultUrlManager.class);
bind(CodeCommentChangeBroadcaster.class);
bind(PullRequestChangeBroadcaster.class);
bind(TaskChangeBroadcaster.class);
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:57,代码来源:WebModule.java
示例5: DefaultMarkdownManager
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
@Inject
public DefaultMarkdownManager(Set<Extension> contributedExtensions, Set<HtmlTransformer> htmlTransformers) {
this.contributedExtensions = contributedExtensions;
this.htmlTransformers = htmlTransformers;
whiteList = new Whitelist() {
@Override
protected boolean isSafeAttribute(String tagName, Element el, Attribute attr) {
if (attr.getKey().startsWith("data-"))
return true;
else
return super.isSafeAttribute(tagName, el, attr);
}
};
whiteList.addTags(SAFE_TAGS)
.addAttributes("a", "href", "title")
.addAttributes("img", "align", "alt", "height", "src", "title", "width")
.addAttributes("div", "itemscope", "itemtype")
.addAttributes(":all", SAFE_ATTRIBUTES)
.addProtocols("a", "href", SAFE_ANCHOR_SCHEMES)
.addProtocols("blockquote", "cite", "http", "https")
.addProtocols("cite", "cite", "http", "https")
.addProtocols("img", "src", "http", "https")
.addProtocols("q", "cite", "http", "https")
.preserveRelativeLinks(true);
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:30,代码来源:DefaultMarkdownManager.java
示例6: render
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
@Override
public String render(String markdown, @Nullable String baseUrl, boolean postProcess) {
Preconditions.checkArgument(baseUrl == null || baseUrl.startsWith("/"));
List<Extension> extensions = new ArrayList<>();
extensions.add(AnchorLinkExtension.create());
extensions.add(TablesExtension.create());
extensions.add(TaskListExtension.create());
extensions.add(DefinitionExtension.create());
extensions.add(TocExtension.create());
extensions.add(AutolinkExtension.create());
extensions.add(new UrlResolveExtension());
extensions.addAll(contributedExtensions);
MutableDataHolder options = new MutableDataSet()
.set(HtmlRenderer.GENERATE_HEADER_ID, true)
.set(AnchorLinkExtension.ANCHORLINKS_SET_NAME, true)
.set(AnchorLinkExtension.ANCHORLINKS_ANCHOR_CLASS, "header-anchor")
.set(AnchorLinkExtension.ANCHORLINKS_TEXT_SUFFIX, "<i class='fa fa-link'></i>")
.set(Parser.SPACE_IN_LINK_URLS, true)
.setFrom(ParserEmulationProfile.GITHUB_DOC)
.set(TablesExtension.COLUMN_SPANS, false)
.set(TablesExtension.APPEND_MISSING_COLUMNS, true)
.set(TablesExtension.DISCARD_EXTRA_COLUMNS, true)
.set(TablesExtension.HEADER_SEPARATOR_COLUMN_MATCH, true)
.set(UrlResolveExtension.BASE_URL, baseUrl)
.set(Parser.EXTENSIONS, extensions);
Parser parser = Parser.builder(options).build();
HtmlRenderer htmlRenderer = HtmlRenderer.builder(options).build();
Node document = parser.parse(markdown);
String html = htmlRenderer.render(document);
if (postProcess)
html = postProcess(html);
return html;
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:41,代码来源:DefaultMarkdownManager.java
示例7: configure
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
@Override
protected void configure() {
addToSet(Extension.class,
AsideExtension.create(),
AttributesExtension.create(),
EnumeratedReferenceExtension.create(),
StrikethroughSubscriptExtension.create(),
TablesExtension.create(),
TaskListExtension.create(),
TocExtension.create()
);
}
开发者ID:JavaEden,项目名称:Orchid,代码行数:13,代码来源:FlexmarkModule.java
示例8: MarkdownAssetsServlet
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
/**
* Construct a {@link MarkdownAssetsServlet} configured with provided parameters, having a wrapped default
* {@link AssetServlet} for fulfilling non-markdown asset requests.
* <p>
* {@code MarkdownAssetsServlet} and {@link AssetServlet} serve static assets loaded from {@code resourceURL}
* (typically a file: or jar: URL). The assets are served at URIs rooted at {@code uriPath}. For
* example, given a {@code resourceURL} of {@code "file:/data/assets"} and a {@code uriPath} of
* {@code "/js"}, an {@code AssetServlet} would serve the contents of {@code
* /data/assets/example.js} in response to a request for {@code /js/example.js}. If a directory
* is requested and {@code indexFile} is defined, then {@code AssetServlet} will attempt to
* serve a file with that name in that directory.
* @param resourcePath the base URL from which assets are loaded
* @param uriPath the URI path fragment in which all requests are rooted
* @param indexFile the filename to use when directories are requested
* @param defaultCharset the default character set
* @param configuration environment-specific configuration properties
* @param extensions Flexmark-Java markdown rendering extensions to use
* @param options Flexmark-Java markdown rendering options
* @param cacheBuilderSpec {@link CacheBuilderSpec} for rendered pages
*/
public MarkdownAssetsServlet(@NotNull String resourcePath,
@NotNull String uriPath,
@NotNull String indexFile,
@NotNull Charset defaultCharset,
@NotNull MarkdownAssetsConfiguration configuration,
@NotNull List<Extension> extensions,
@NotNull DataHolder options,
@NotNull CacheBuilderSpec cacheBuilderSpec) {
this.resourcePath = resourcePath;
this.uriPath = uriPath;
this.indexFile = indexFile;
this.defaultCharset = defaultCharset;
this.configuration = configuration;
parser = Parser.builder(options).extensions(extensions).build();
renderer = HtmlRenderer.builder(options).extensions(extensions).build();
assetServlet = new AssetServlet(resourcePath, uriPath, indexFile, defaultCharset);
pageCache = CacheBuilder.from(cacheBuilderSpec)
.build(new CacheLoader<URL, CachedPage>() {
@Override
public CachedPage load(@NotNull URL key) throws Exception {
return renderPage(key);
}
});
try {
URL resource = this.getClass().getResource(resourcePath);
Preconditions.checkNotNull(resource, "Resource root URL (" + resourcePath + ") was not found");
resourceRootURL = resource.toURI();
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Resource root URL (" + resourcePath + ") was ind", e);
}
}
开发者ID:rnorth,项目名称:dropwizard-markdown-assets-bundle,代码行数:56,代码来源:MarkdownAssetsServlet.java
示例9: setExtensions
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public void setExtensions(List<Extension> extensions) {
options.remove(EXTENSIONS);
options.set(EXTENSIONS, extensions);
logger.debug("Resetting markdown parser extensions: {}", options.get(Parser.EXTENSIONS).toString());
}
开发者ID:jdesive,项目名称:textmd,代码行数:6,代码来源:MarkdownParser.java
示例10: getExtensions
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public List<Extension> getExtensions() {
return (List<Extension>) options.get(Parser.EXTENSIONS);
}
开发者ID:jdesive,项目名称:textmd,代码行数:4,代码来源:MarkdownParser.java
示例11: containsExtension
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
private boolean containsExtension(final Extension extension) {
final AtomicBoolean flag = new AtomicBoolean(false);
getExtensions().forEach(ext -> {
if(ext.getClass().getName().equals(extension.getClass().getName())){
flag.set(true);
}
});
return flag.get();
}
开发者ID:jdesive,项目名称:textmd,代码行数:10,代码来源:MarkdownParser.java
示例12: create
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public static Extension create() {
return new LocalizationExtension();
}
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:4,代码来源:LocalizationExtension.java
示例13: create
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public static Extension create() {
return new TwitterExtension();
}
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:4,代码来源:TwitterExtension.java
示例14: create
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public static Extension create() {
return new KeystrokeExtension();
}
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:4,代码来源:KeystrokeExtension.java
示例15: create
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public static Extension create() {
return new MarkExtension();
}
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:4,代码来源:MarkExtension.java
示例16: create
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public static Extension create() {
return new ButtonExtension();
}
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:4,代码来源:ButtonExtension.java
示例17: create
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public static Extension create() {
return new MathJaxExtension();
}
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:4,代码来源:MathJaxExtension.java
示例18: create
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public static Extension create() {
return new LabelExtension();
}
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:4,代码来源:LabelExtension.java
示例19: create
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public static Extension create() {
return new EmojiExtension();
}
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:4,代码来源:EmojiExtension.java
示例20: create
import com.vladsch.flexmark.Extension; //导入依赖的package包/类
public static Extension create() {
return new VideoLinkExtension();
}
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:4,代码来源:VideoLinkExtension.java
注:本文中的com.vladsch.flexmark.Extension类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论