Interface MarkflowPlugin
- All Known Implementing Classes:
CorePlugin
Markflow to configure how parsing and rendering
of Markdown is carried on.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThis class holds registered plugins and used to set dependencies. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidafterRender(org.commonmark.node.Node document, MarkflowVisitor visitor) This method will be called after rendering (but before applying markdown to a TextView, if such action will happen).default voidafterSetText(TextView textView) This method will be called after markdown was applied.default voidbeforeRender(org.commonmark.node.Node document) This method will be called before rendering will occur thus making possible topost-processparsed node (make changes for example).default voidbeforeSetText(TextView textView, Spanned markdown) This method will be called before callingTextView#setText.default voidconfigure(MarkflowPlugin.Registry registry) This method will be called before any other duringMarkflowinstance construction.default voidconfigureConfig(MarkflowConfig.Builder builder) Method to configure span factories and miscellaneous used for rendering of Markdown.default voidconfigureParser(org.commonmark.parser.Parser.Builder builder) Method to configureParser(for example register custom extension, etc.).default voidconfigureTheme(MarkflowTheme.Builder builder) Method to configureMarkflowThemethat is used for rendering of Markdown.default voidconfigureVisitor(MarkflowVisitor.Builder builder) Method to configure node visitors used for rendering of Markdown.default CharSequenceprocessMarkdown(CharSequence markdown) Process input Markdown text and return a CharSequence to be used in parsing stage further.
-
Method Details
-
configure
This method will be called before any other duringMarkflowinstance construction. Used to set dependencies and tweak certain plugin.- Parameters:
registry- the plugin registry
-
configureParser
Method to configureParser(for example register custom extension, etc.). -
configureTheme
Method to configureMarkflowThemethat is used for rendering of Markdown. -
configureConfig
Method to configure span factories and miscellaneous used for rendering of Markdown. -
configureVisitor
Method to configure node visitors used for rendering of Markdown. -
processMarkdown
Process input Markdown text and return a CharSequence to be used in parsing stage further. Can be described aspre-processingof raw Markdown.The input CharSequence must be read-only by the method implementation. The implementation should return either the input as-is or return a new CharSequence. The implementation should never hold references to the input; and should not hold references the return object, unless the return object is a String (immutable).
This method will be called from ANY thread.
- Parameters:
markdown- input text to process- Returns:
- processed Markdown text
-
beforeRender
This method will be called before rendering will occur thus making possible topost-processparsed node (make changes for example).This method will be called from ANY thread.
- Parameters:
document- the root document
-
afterRender
default void afterRender(@NonNull org.commonmark.node.Node document, @NonNull MarkflowVisitor 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 modifyingnodewon\'t have any effect as it has been already visited at this stage.This method will be called from ANY thread.
- Parameters:
document- the root documentvisitor-MarkflowVisitorinstance used to render Markdown
-
beforeSetText
This method will be called before callingTextView#setText.It can be useful to prepare a TextView for rendered Markdown.
This method will be called from UI thread.
- Parameters:
textView- the TextView to whichmarkdownwill be appliedmarkdown- the 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 rendered Markdown as at this point spans must be queried by callingTextView#getText#getSpans.This method will be called from UI thread.
- Parameters:
textView- the TextView to which markdown was applied
-