Package icyllis.modernui.markdown
Interface MarkdownPlugin
- All Known Implementing Classes:
CorePlugin
public interface MarkdownPlugin
Class represents an extension to
Markdown
to configure how parsing and rendering
of markdown is carried on.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
afterRender
(com.vladsch.flexmark.util.ast.Node document, MarkdownVisitor visitor) This method will be called after rendering (but before applying markdown to a TextView, if such action will happen).default void
afterSetText
(TextView textView) This method will be called after markdown was applied.default void
beforeRender
(com.vladsch.flexmark.util.ast.Node document) This method will be called before rendering will occur thus making possible topost-process
parsed node (make changes for example).default void
beforeSetText
(TextView textView, Spanned markdown) This method will be called before callingTextView#setText
.default void
configure
(MarkdownPlugin.Registry registry) This method will be called before any other duringMarkdown
instance construction.default void
configureConfig
(MarkdownConfig.Builder builder) default void
configureParser
(com.vladsch.flexmark.parser.Parser.Builder builder) default void
configureTheme
(MarkdownTheme.Builder builder) default String
processMarkdown
(String markdown) Process input markdown and return new string to be used in parsing stage further.
-
Method Details
-
configure
This method will be called before any other duringMarkdown
instance construction.- Parameters:
registry
- the plugin registry
-
configureParser
- Parameters:
builder
-
-
configureTheme
- Parameters:
builder
-
-
configureConfig
- Parameters:
builder
-
-
processMarkdown
Process input markdown and return new string to be used in parsing stage further. Can be described aspre-processing
of markdown String.- Parameters:
markdown
- String to process- Returns:
- processed markdown String
-
beforeRender
This method will be called before rendering will occur thus making possible topost-process
parsed node (make changes for example).- Parameters:
document
- root document
-
afterRender
default void afterRender(@NonNull com.vladsch.flexmark.util.ast.Node document, @NonNull MarkdownVisitor visitor) This method will be called after rendering (but before applying markdown to a TextView, if such action will happen). It can be used to clean some internal state, or trigger certain action. Please note that modifyingnode
won\'t have any effect as it has been already visited at this stage.- Parameters:
document
- root documentvisitor
-MarkdownVisitor
instance used to render markdown
-
beforeSetText
This method will be called before callingTextView#setText
.It can be useful to prepare a TextView for markdown.
- Parameters:
textView
- TextView to whichmarkdown
will be appliedmarkdown
- Rendered markdown
-
afterSetText
This method will be called after markdown was applied.It can be useful to trigger certain action on spans/textView.
Unlike
beforeSetText(TextView, Spanned)
this method does not receive parsed markdown as at this point spans must be queried by callingTextView#getText#getSpans
.- Parameters:
textView
- TextView to which markdown was applied
-