This Mac sample is quite useful for authoring and viewing Markdown files, but also offers a little insight into building a hybrid web and native Mac application.

  • MonoMac.AppKit.NSDocument is used for automatic document handling.
  • The MonoMac.WebKit.WebView control is used for rendering.
  • File system monitoring through MonoMac.CoreServices.FSEventStream is used to monitor the loaded document for changes.
  • Changes made are reflected by replacing content directly in the DOM.
  • JavaScript is used to scroll the page, invoked from native code.
  • Navigation events are intercepted to open links in the system browser.

Under the hood

The Sundown C library is used to actually convert Markdown to HTML. In addition all the Github extensions are enabled. A small C# binding to Sundown is included.