com.vladsch.flexmark.Extension Java Examples
The following examples show how to use
com.vladsch.flexmark.Extension.
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: Markdown2HtmlUtil.java From plumemo with Apache License 2.0 | 5 votes |
/** * Markdownz转为Html * @param content * @return */ public static String html(String content){ MutableDataSet options = new MutableDataSet(); options.setFrom(ParserEmulationProfile.MARKDOWN); options.set(Parser.EXTENSIONS, Arrays.asList(new Extension[]{TablesExtension.create()})); Parser parser = Parser.builder(options).build(); HtmlRenderer renderer = HtmlRenderer.builder(options).build(); Node document = parser.parse(content); return renderer.render(document); }
Example #2
Source File: DefaultMarkdownManager.java From onedev with MIT License | 5 votes |
@Override public String render(String markdown) { 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.addAll(contributedExtensions); MutableDataHolder options = new MutableDataSet() .set(HtmlRenderer.GENERATE_HEADER_ID, true) .set(AnchorLinkExtension.ANCHORLINKS_SET_NAME, true) .set(AnchorLinkExtension.ANCHORLINKS_WRAP_TEXT, false) .set(AnchorLinkExtension.ANCHORLINKS_TEXT_PREFIX, "<span class='header-anchor'></span>") .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(Parser.EXTENSIONS, extensions); Parser parser = Parser.builder(options).build(); HtmlRenderer htmlRenderer = HtmlRenderer.builder(options).build(); Node document = parser.parse(markdown); return htmlRenderer.render(document); }
Example #3
Source File: MarkDownModel.java From Orienteer with Apache License 2.0 | 5 votes |
private List<Extension> createExtensions() { List<Extension> extensions = new LinkedList<>(); extensions.add(TablesExtension.create()); extensions.add(StrikethroughExtension.create()); extensions.add(EmojiExtension.create()); return extensions; }
Example #4
Source File: MarkExtension.java From OmniList with GNU Affero General Public License v3.0 | 4 votes |
public static Extension create() { return new MarkExtension(); }
Example #5
Source File: MathJaxExtension.java From OmniList with GNU Affero General Public License v3.0 | 4 votes |
public static Extension create() { return new MathJaxExtension(); }
Example #6
Source File: CoreModule.java From onedev with MIT License | 4 votes |
private void configureWeb() { bind(WicketServlet.class).to(DefaultWicketServlet.class); bind(WicketFilter.class).to(DefaultWicketFilter.class); bind(WebSocketPolicy.class).toProvider(WebSocketPolicyProvider.class); bind(EditSupportRegistry.class).to(DefaultEditSupportRegistry.class); bind(WebSocketManager.class).to(DefaultWebSocketManager.class); bind(AttachmentUploadServlet.class); contributeFromPackage(EditSupport.class, EditSupport.class); bind(WebApplication.class).to(OneWebApplication.class); bind(Application.class).to(OneWebApplication.class); bind(AvatarManager.class).to(DefaultAvatarManager.class); bind(WebSocketManager.class).to(DefaultWebSocketManager.class); contributeFromPackage(EditSupport.class, EditSupportLocator.class); contribute(WebApplicationConfigurator.class, new WebApplicationConfigurator() { @Override public void configure(WebApplication application) { application.mount(new OnePageMapper("/test", TestPage.class)); } }); bind(CommitIndexedBroadcaster.class); contributeFromPackage(DiffRenderer.class, DiffRenderer.class); contributeFromPackage(BlobRendererContribution.class, BlobRendererContribution.class); contribute(Extension.class, new EmojiExtension()); contribute(Extension.class, new SourcePositionTrackExtension()); contributeFromPackage(MarkdownProcessor.class, MarkdownProcessor.class); contribute(ResourcePackScopeContribution.class, new ResourcePackScopeContribution() { @Override public Collection<Class<?>> getResourcePackScopes() { return Lists.newArrayList(OneWebApplication.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, OneException.class, PageExpiredException.class, StalePageException.class); } }); bind(UrlManager.class).to(DefaultUrlManager.class); bind(CodeCommentEventBroadcaster.class); bind(PullRequestEventBroadcaster.class); bind(IssueEventBroadcaster.class); bind(BuildEventBroadcaster.class); bind(TaskButton.TaskFutureManager.class); bind(UICustomization.class).toInstance(new UICustomization() { @Override public Class<? extends BasePage> getHomePage() { return DashboardPage.class; } @Override public List<MainTab> getMainTabs() { return Lists.newArrayList( new ProjectListTab(), new IssueListTab(), new PullRequestListTab(), new BuildListTab()); } }); }
Example #7
Source File: DefaultMarkdownManager.java From onedev with MIT License | 4 votes |
@Inject public DefaultMarkdownManager(Set<Extension> contributedExtensions, Set<MarkdownProcessor> htmlTransformers) { this.contributedExtensions = contributedExtensions; this.htmlTransformers = htmlTransformers; }
Example #8
Source File: TwitterExtension.java From MarkdownView with Apache License 2.0 | 4 votes |
public static Extension create() { return new TwitterExtension(); }
Example #9
Source File: KeystrokeExtension.java From MarkdownView with Apache License 2.0 | 4 votes |
public static Extension create() { return new KeystrokeExtension(); }
Example #10
Source File: MarkExtension.java From MarkdownView with Apache License 2.0 | 4 votes |
public static Extension create() { return new MarkExtension(); }
Example #11
Source File: MathJaxExtension.java From MarkdownView with Apache License 2.0 | 4 votes |
public static Extension create() { return new MathJaxExtension(); }
Example #12
Source File: LabelExtension.java From MarkdownView with Apache License 2.0 | 4 votes |
public static Extension create() { return new LabelExtension(); }
Example #13
Source File: EmojiExtension.java From MarkdownView with Apache License 2.0 | 4 votes |
public static Extension create() { return new EmojiExtension(); }
Example #14
Source File: BeanExtension.java From MarkdownView with Apache License 2.0 | 4 votes |
public static Extension create() { return new BeanExtension(); }
Example #15
Source File: VideoLinkExtension.java From MarkdownView with Apache License 2.0 | 4 votes |
public static Extension create() { return new VideoLinkExtension(); }