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

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default 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
    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 to post-process parsed node (make changes for example).
    default void
    beforeSetText(TextView textView, Spanned markdown)
    This method will be called before calling TextView#setText.
    default void
    This method will be called before any other during Markdown instance construction.
    default void
     
    default void
    configureParser(com.vladsch.flexmark.parser.Parser.Builder builder)
     
    default void
     
    default String
    Process input markdown and return new string to be used in parsing stage further.
  • Method Details

    • configure

      default void configure(@NonNull MarkdownPlugin.Registry registry)
      This method will be called before any other during Markdown instance construction.
      Parameters:
      registry - the plugin registry
    • configureParser

      default void configureParser(@NonNull com.vladsch.flexmark.parser.Parser.Builder builder)
      Parameters:
      builder -
    • configureTheme

      default void configureTheme(@NonNull MarkdownTheme.Builder builder)
      Parameters:
      builder -
    • configureConfig

      default void configureConfig(@NonNull MarkdownConfig.Builder builder)
      Parameters:
      builder -
    • processMarkdown

      @NonNull default String processMarkdown(@NonNull String markdown)
      Process input markdown and return new string to be used in parsing stage further. Can be described as pre-processing of markdown String.
      Parameters:
      markdown - String to process
      Returns:
      processed markdown String
    • beforeRender

      default void beforeRender(@NonNull com.vladsch.flexmark.util.ast.Node document)
      This method will be called before rendering will occur thus making possible to post-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 modifying node won\'t have any effect as it has been already visited at this stage.
      Parameters:
      document - root document
      visitor - MarkdownVisitor instance used to render markdown
    • beforeSetText

      default void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown)
      This method will be called before calling TextView#setText.

      It can be useful to prepare a TextView for markdown.

      Parameters:
      textView - TextView to which markdown will be applied
      markdown - Rendered markdown
    • afterSetText

      default void afterSetText(@NonNull TextView textView)
      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 calling TextView#getText#getSpans.

      Parameters:
      textView - TextView to which markdown was applied