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

public bool AddMenuItem(MenuItem mitem,     string menuItemNameForInsertionAfter,     string menuItemTextForInsertionAfter,     AddMenuItemModes addMode)

public bool AddMenuItem(MenuItem mitem,     string menuItemNameForInsertionAfter,     string menuItemTextForInsertionAfter,     int mode)


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

public void CloseTab(TabItem tab)

public void CloseTab(string filename)


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

public void ExecuteEditCommand(string action)


Returns the active live markdown text from the editor

public string GetMarkdown()


Returns the Markdown document 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.

This control should return an IPreviewBrowser interface implemented on a WPF UIControl (UserControl most likely).

public virtual IPreviewBrowser GetPreviewBrowserUserControl()


Gets the active selection from the editor

public string GetSelection()


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

public virtual void OnAfterOpenDocument(MarkdownDocument doc)


Called after the document has been saved.

public virtual void OnAfterSaveDocument(MarkdownDocument doc)


Called just before the application is shut down

public virtual void OnApplicationShutdown()


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

Use this handler to add new menu items to the Addin Toolbar.

public virtual void OnApplicationStart()


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

public virtual bool OnBeforeOpenDocument(string filename)


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

public virtual bool 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 void 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 void OnDocumentUpdated()


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

Allows adding custom handlers for additional markdown expansions you'd like to fire from custom buttons, or using AdditionalToolbarIcons.

public virtual string OnEditorCommand(string command,     string input)


Called when the Menu or Toolbar button is clicked

public virtual void OnExecute(object sender)


Called when the configuration Toolbar drop down button is clicked

public virtual void 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 void 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 string OnModifyPreviewHtml(string renderedHtml,     string markdownHtml)


An optional command string that is fired into addins

You can override this method to capture commands that are not already handled by the editor.

public virtual void OnNotifyAddin(string command,     object parameter)


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

public virtual bool 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 string OnSaveImage(object image)


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

public virtual void OnUninstall()


public virtual void OnWindowLoaded()


Opens a tab with a given filename and selects it

public TabItem OpenTab(string filename)


Refreshes the Html Preview Window if active

public void RefreshPreview(bool keepScrollPosition)


Brings the editor to focus

public void SetEditorFocus()


Sets all the text in the markdown editor

public void SetMarkdown(string markdownText)


Sets the active selection from the editor

public void 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.

Contains an AceEditor property that references the underlying JavaScript editor wrapper instance.


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, 1996-2021 • Updated: 02/14/20
Comment or report problem with topic