Class MarkdownMonsterAddin

Addin Base class that exposes core functionality to the addin.

public abstract class MarkdownMonsterAddin : object

Class Members



Allows insertion of a menu item relative to another menu item by name or menu text

public bool AddMenuItem(MenuItem mitem,     string menuItemNameToFind,     string menuItemTextToFind,     AddMenuItemModes addMode)


Closes a specific tab that you pass. You can look at the tab collection via Model.Window.TabControl.

public Task CloseTab(TabItem tab)

public Task CloseTab(string filename)


Executes a predefined edit command (bold,italic,href etc.) against the editor.

public Task ExecuteEditCommand(string action)


Returns the active live markdown text from the editor

public Task GetMarkdown()


Returns the Markdown document object instance which has access to the actual document that ends up being saved. This includes the content and the IsDirty flag. Note that content is updated only after save operations. If you need to update live content it's best to inject directly into the edtor using the GetSelectedText() and SetSelectedText().

public MarkdownDocument GetMarkdownDocument()


Retrieve an instance of the MarkdownEditor control from the active window. This instance wraps the editor and provides a number of methods for getting access to the editor document

public MarkdownDocumentEditor GetMarkdownEditor()


If this addin wants to provide a custom Markdown Parser this method can be overriden to do it.

public virtual IMarkdownParser GetMarkdownParser(bool usePragmaLines,     bool force)


Allows returning a WPF control that implements IPreviewBrowser and that handles previewing the output from documents.

public virtual IPreviewBrowser GetPreviewBrowserUserControl()


Gets the active selection from the editor

public Task GetSelection()


Called after a new document has been opened. If this is a new document the filename will be 'untitled'

public virtual Task OnAfterOpenDocument(MarkdownDocument doc)


Called after the document has been saved.

public virtual Task OnAfterSaveDocument(MarkdownDocument doc)


Fired when the application has Initialized, the Window is available and the model has been loaded. This happens after OnApplicationStart() but before OnWindowLoaded() and allows you to access the Model and Window before initial data binding of the Window occurs.

public virtual Task OnApplicationInitialized(AppModel model)


Called just before the application is shut down

public virtual Task OnApplicationShutdown()


Called when the application starts and after the AddinManager has initialized.

public virtual Task OnApplicationStart()


Called before a document is opened. Return false to keep the document from being opened

public virtual Task OnBeforeOpenDocument(string filename)


Called before the document is saved. Return false to disallow saving the document

public virtual Task OnBeforeSaveDocument(MarkdownDocument doc)


Called to determine whether the menu option should be enabled and execute

public virtual bool OnCanExecute(object sender)


Called whenever a new document is activated in the editor (when tabs change). Note on startup if multiple documents are open this method is called for each document.

public virtual Task OnDocumentActivated(MarkdownDocument doc)


Called whenever the document is updated and the document's current text is updated. Note this may not be always 100% in sync of what's in the editor as the document is updated only when the user stops typing for around a second.

public virtual Task OnDocumentUpdated()


Optional editor command handler that can intercept editor commands like bold/italic that are fired if not handled previously by the default handlers.

public virtual Task OnEditorCommand(string command,     string input)


Called when the Menu or Toolbar button is clicked

public virtual Task OnExecute(object sender)


Called when the configuration Toolbar drop down button is clicked

public virtual Task OnExecuteConfiguration(object sender)


Called after the addin is initially installed. Use this method to install additional resources or add additional one time configuration.

public virtual void OnInstall()


Fired when the application has Initialized the Model. This happens after OnApplicationStart() but before OnWindowLoaded() and allows you to access the Model before initial data binding of the Window occurs.

public virtual Task OnModelLoaded(AppModel model)


Allows addins to intercept the html used for the preview, to examine or further manipulate it, e.g. insert a style block in the head.

public virtual Task OnModifyPreviewHtml(string renderedHtml,     string markdownHtml)


An optional command string that is fired into addins

public virtual Task OnNotifyAddin(string command,     object parameter)


Allows you to detect Preview Browser Link navigation and take over the navigation.

public virtual Task OnPreviewLinkNavigation(string url,     string src)


Called when an image is to be saved. By default MM saves images to disk. You can hook this method with your add in to take over the image save operation. Return true to indicate you handled the

public virtual Task OnSaveImage(object image)


Called after the addin has been uninstalled. Allows for additional cleanup.

public virtual void OnUninstall()


Fired when the main application window has been loaded and the main Markdown Monster Application Model is available. Access the Window with mmApp.Model.Window.

public virtual Task OnWindowLoaded()


Opens a tab with a given filename and selects it

public Task OpenTab(string filename)


Refreshes the Html Preview Window if active.

public void RefreshPreview(bool keepScrollPosition)


Brings the editor to focus

public Task SetEditorFocus()


Sets all the text in the markdown editor

public Task SetMarkdown(string markdownText)


Sets the active selection from the editor.

public Task SetSelection(string text)


Displays a status message on the main application's status bar

public void ShowStatus(string message,     int timeoutMs,     FontAwesomeIcon icon,     Color color,     bool spin)


Displays and error message on the status bar using common default values (red icon, standard timeout, warning icon)

public void ShowStatusError(string message,     int timeout,     FontAwesomeIcon icon,     Color color)


Returns the active Markdown document that's being edited. The document holds the actual markdown text and knows how to load, save and render the markdown contained within it.


Returns an instance of the Active Editor instance. The editor contains editor behavior of the browser control as well as all interactions with the editor's event model and text selection interfaces.


Optional Id for this addin - use a recognizable Id


Determines whether this addin is enabled


List of menu items that are used to extend MM Menu items get attached to the Addin menu and fire when clicked.


The application model which gives you access to Markdown Monster. Includes access to Configuration and the Main Window


The display name of the Addin


Namespace: MarkdownMonster.AddIns
Assembly: markdownmonster.exe

© West Wind Technologies, 2016-2024 • Updated: 11/23/21
Comment or report problem with topic