A modern Markdown file viewer and editor addin for the Clarion IDE. Features a split-pane interface with live preview, syntax highlighting, dark mode, scroll synchronization, and seamless IDE integration.
-
Split-Pane Editor: Side-by-side markdown source and live HTML preview
-
Live Preview: Real-time rendering as you type
-
Mermaid Diagrams: Create flowcharts, sequence diagrams, ERDs, Gantt charts, and more
- Just use
```mermaidcode blocks - See
MermaidExample.mdfor examples - Supports all Mermaid diagram types (flowchart, sequence, ER, Gantt, state, class, etc.)
- Just use
-
Syntax Highlighting: Full code syntax highlighting powered by Highlight.js
- Custom Clarion language definition included
- Supports 190+ languages (JavaScript, Python, C#, SQL, etc.)
- Atom One Dark theme (works in both light and dark modes)
To use syntax highlighting, open a fenced code block with three backticks followed by the language name, e.g.:
```clarion MyProc PROCEDURE CODE MESSAGE('Hello from Clarion!') RETURN ```…which renders as:
MyProc PROCEDURE CODE MESSAGE('Hello from Clarion!') RETURN
-
Dark Mode: Toggle between light and dark themes via View > Dark Mode or the 🌓 button on the Start Page — preference is remembered across sessions
-
Scroll Synchronization: Bidirectional scroll sync between editor and preview (toggleable)
-
Horizontal Scrolling: Long lines scroll instead of wrapping
-
Expand/Collapse Preview: Toggle between split view and full-width preview mode
-
Formatting Toolbar: Quick buttons for common markdown syntax:
- Bold, Italic, Inline Code, Code Blocks
- Headers (H1, H2, H3)
- Bullet Lists, Numbered Lists
- Blockquotes, Horizontal Rules
- Links, Images, Tables
-
File Operations: New, Open, Save, Save As
-
Open Markdown from URL: Load a Markdown document directly from a URL — raw URLs,
github.com/owner/repo/blob/..., or justgithub.com/owner/repo(auto-resolves toREADME.mdonmain, falling back tomaster). URL-loaded tabs are read-only with a 🔒 badge; Save As promotes them into editable local files. Relative images and links resolve against the source URL, and clicking a relative.mdlink opens it as a new tab. Fetched bodies are cached under%APPDATA%\ClarionMarkdownEditor\cache\with conditional GETs, so reopens are fast and a stale copy is served when offline. Available via Tools → Open Markdown from URL... or the 🌐 Open URL... button on the Start Page (Recent URLs list included) -
About Dialog: View credits and project information (File > About)
-
IDE Integration: Insert markdown content directly into the active Clarion editor
-
Keyboard Shortcuts:
Ctrl+Alt+M- Open Markdown Editor padCtrl+S- Save current documentCtrl+B- BoldCtrl+I- Italic- All formatting shortcuts support undo (Ctrl+Z)
-
Dockable Pad: Can be docked anywhere in the Clarion IDE workspace
-
File Type Handler: Opening a
.mdor.markdownfile in the IDE automatically opens it in the Markdown Editor — all files share a single editor instance with internal tabs -
Remembers Settings: Last opened folder and dark mode preference saved between sessions
-
Dirty Indicator: The editor tab shows
*when a document has unsaved changes — clears automatically when changes are undone back to the last-saved state
- Clarion 10 or later (tested in Clarion 10, 11.1, and 12)
- .NET Framework 4.8 or higher
- Microsoft Edge WebView2 Runtime (usually pre-installed on Windows 10/11)
- .NET SDK (any modern version — used to run
dotnet build) - Clarion IDE installed (for reference DLLs)
Note: Visual Studio is not required. The .NET SDK is a free, lightweight command-line toolchain. Download the latest version from https://dotnet.microsoft.com/download and run the installer —
dotnet buildwill then be available in any terminal.
You can open ClarionMarkdownEditor.slnx in any of the following:
-
Visual Studio Code (free, lightweight) Recommended extensions:
- C# Dev Kit — IntelliSense, build, debug
- C# — language support (installed with C# Dev Kit)
- NuGet Gallery — browse and manage NuGet packages
- XML — syntax support for .addin and .props files
-
Visual Studio Community (free for open source) Open the .slnx file directly — all packages restore automatically on first build.
-
JetBrains Rider (commercial, free for open source) Full .NET IDE with excellent SDK-style project support.
- Download the latest release
- Copy all files to:
Required files:
{CLARION_PATH}\accessory\addins\MarkdownEditor\ClarionMarkdownEditor.dllClarionMarkdownEditor.addinMicrosoft.Web.WebView2.Core.dllMicrosoft.Web.WebView2.WinForms.dllWebView2Loader.dllResources\markdown-editor.htmlResources\markdown-editor.cssResources\markdown-editor.jsResources\marked.min.jsResources\highlight.min.jsResources\atom-one-dark.min.css
- Unblock the DLLs — Windows tags files extracted from a downloaded zip with
"mark-of-the-web", which prevents .NET from loading them. Either:
- Right-click the zip before extracting → Properties → tick Unblock → OK, then extract, or
- After extracting, run this in PowerShell against the install folder:
Get-ChildItem "C:\Clarion12\accessory\addins\MarkdownEditor" -Recurse | Unblock-File
- Ensure WebView2 Runtime is installed
- Restart Clarion IDE
-
Clone this repository
git clone https://github.com/msarson/ClarionMarkdownEditor.git cd ClarionMarkdownEditor -
Configure your Clarion path
The project uses
Directory.Build.propsto locate your Clarion installation. The default path isC:\Clarion12\bin.If your Clarion is installed elsewhere, create a file called
ClarionMarkdownEditor\Directory.Build.props.user(gitignored) with:<Project> <PropertyGroup> <ClarionBin>C:\Clarion\Clarion11.1\bin</ClarionBin> </PropertyGroup> </Project>
Alternatively, set the
CLARION_BINenvironment variable before building:$env:CLARION_BIN = "C:\Clarion\Clarion11.1\bin"
-
Build — NuGet packages (including WebView2) are restored automatically:
dotnet build ClarionMarkdownEditor\ClarionMarkdownEditor.csproj -c Release -
Deploy to Clarion
Copy from
ClarionMarkdownEditor\bin\Release\net48\to{CLARION_PATH}\accessory\addins\MarkdownEditor\:ClarionMarkdownEditor.dllClarionMarkdownEditor.addinMicrosoft.Web.WebView2.Core.dllMicrosoft.Web.WebView2.WinForms.dllWebView2Loader.dllResources\markdown-editor.htmlResources\markdown-editor.cssResources\markdown-editor.jsResources\marked.min.jsResources\highlight.min.jsResources\atom-one-dark.min.css
-
Restart Clarion IDE
┌─────────────────────────────────────────────────────────────┐
│ New Open Save Save As │ Insert to IDE │ filename.md │
├─────────────────────────────────────────────────────────────┤
│ B │ I │ </> │ {} │ Link │ Img │ H1 │ H2 │ H3 │ List │ ... │
├────────────────────────────┬────────────────────────────────┤
│ MARKDOWN │ PREVIEW [Expand]│
├────────────────────────────┼────────────────────────────────┤
│ # My Document │ My Document │
│ │ ─────────── │
│ This is **bold** text. │ This is bold text. │
│ │ │
│ - Item 1 │ • Item 1 │
│ - Item 2 │ • Item 2 │
└────────────────────────────┴────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ PREVIEW [Split]│
├─────────────────────────────────────────────────────────────┤
│ │
│ My Document │
│ ─────────────────────────────────────────── │
│ │
│ This is bold text. │
│ │
│ • Item 1 │
│ • Item 2 │
│ │
└─────────────────────────────────────────────────────────────┘
The Markdown Editor can be opened in two different modes:
- Keyboard: Press
Ctrl+Alt+M - Menu: Go to
Tools → Markdown Editor (Pad) - Opens as a dockable tool window that can be positioned on any side of the IDE
- Menu: Go to
Tools → Markdown Editor (Window) - Opens in the main document area alongside your source code files
- Useful when you want to work on markdown files like regular documents
- Click Open to load an existing
.mdfile, or start typing in a new document - Use the formatting toolbar for quick markdown syntax insertion
- Preview updates in real-time as you type
- Split View: Editor and preview side-by-side (default)
- Expanded Preview: Click Expand button to hide the editor and view preview full-width
- Return to Split: Click Split button to restore side-by-side view
Click Insert to IDE to insert the current markdown content at the cursor position in the active Clarion source editor.
| Element | Syntax |
|---|---|
| Heading 1 | # Heading |
| Heading 2 | ## Heading |
| Heading 3 | ### Heading |
| Bold | **bold** or __bold__ |
| Italic | *italic* or _italic_ |
| Inline Code | `code` |
| Code Block | ```language ... ``` |
| Link | [text](url) |
| Image |  |
| Unordered List | - item or * item |
| Ordered List | 1. item |
| Blockquote | > quote |
| Horizontal Rule | --- or *** |
| Table | ` |
MarkDownAddin/
├── ClarionMarkdownEditor.sln
├── addin-config.json
├── README.md
└── ClarionMarkdownEditor/
├── ClarionMarkdownEditor.csproj
├── ClarionMarkdownEditor.addin # SharpDevelop addin manifest
├── Directory.Build.props # Clarion path config (ClarionBin variable)
├── Properties/
│ └── AssemblyInfo.cs
├── MarkdownEditorPad.cs # Dockable pad container
├── MarkdownEditorViewContent.cs # Document window container
├── MarkdownEditorControl.cs # Main control with WebBrowser
├── MarkdownEditorControl.Designer.cs
├── ShowMarkdownEditorCommand.cs # Tools menu command (Pad mode)
├── ShowMarkdownEditorWindowCommand.cs # Tools menu command (Window mode)
├── Services/
│ ├── EditorService.cs # IDE editor interaction
│ ├── SettingsService.cs # User settings persistence
│ └── ScriptBridge.cs # JS-to-C# communication
└── Resources/
├── markdown-editor.html # HTML structure (UI skeleton)
├── markdown-editor.css # All editor styles (light/dark/layout)
├── markdown-editor.js # All editor behaviour (tabs, preview, dirty tracking)
├── marked.min.js # marked.js markdown parser (bundled, MIT)
├── highlight.min.js # Highlight.js syntax highlighting library
└── atom-one-dark.min.css # Highlight.js theme
- UI Layer: HTML/CSS/JavaScript in WebView2 (Chromium-based)
- Modern Browser Engine: WebView2 provides full modern web standards support
- Native Toolbar: WinForms ToolStrip for file operations
- Markdown Parser: marked.js 11.2.0 — CommonMark + GFM (tables, task lists, strikethrough, autolinks)
- Syntax Highlighting: Highlight.js 11.9.0 with custom Clarion language definition
- IDE Integration: Uses reflection for compatibility across Clarion IDE versions
Migrated from old IE-based WebBrowser to WebView2 (Chromium) to enable:
- Modern JavaScript support (ES6+)
- Proper execution of minified libraries
- Full CSS3 support including flexbox and grid
- Better performance and security
- Syntax highlighting with Highlight.js
- Library: marked.js 11.2.0 (MIT License)
- Features: CommonMark-compliant, with GFM extensions enabled (
gfm: true) for tables, task lists, strikethrough, and autolinks - Line breaks:
breaks: false— a lone newline is treated as whitespace per CommonMark, not a<br> - Mermaid integration: a renderer override maps
```mermaidcode fences to<div class="mermaid">…</div>so the existing mermaid rendering pass continues to work - Injection: C#-based file injection (no CDN dependency, works offline)
- File:
marked.min.js(~35 KB)
- Library: Highlight.js 11.9.0 (BSD-3-Clause License)
- Theme: Atom One Dark
- Injection: C#-based file injection (no CDN dependencies, works offline)
- Custom Language: Full Clarion language definition from discourse-highlightjs-clarion
- Files:
highlight.min.js(121KB) andatom-one-dark.min.css(856 bytes) - Auto-detection suppressed for no-language fences: only code blocks with an explicit
language-…class get highlighted, so untagged fences render as plain monospace
User settings are stored in:
%APPDATA%\ClarionMarkdownEditor\settings.txt
Cached URL bodies are stored alongside under cache\ as <hash>.body
(content) and <hash>.meta (ETag, Last-Modified, stored timestamp)
pairs. Safe to delete the whole cache\ folder at any time.
Other Clarion IDE addins can ask the Markdown Editor to open a URL
without taking a hard reference on ClarionMarkdownEditor.dll — useful
when the editor may or may not be installed on the user's machine:
var t = Type.GetType("ClarionMarkdownEditor.MarkdownEditorApi, ClarionMarkdownEditor");
t?.GetMethod("OpenUrl")?.Invoke(null, new object[] { url });MarkdownEditorApi.OpenUrl(string url) ensures the editor pad is
visible, fetches the document (with cache + offline fallback), and
opens it in a new read-only tab. Errors surface as in-editor message
boxes — the call itself is fire-and-forget and never throws back to
the caller.
If the editor isn't installed, Type.GetType returns null and the
expression silently falls back. A typical caller will then offer to
launch the URL in the system browser instead.
- Initial commit: Basic markdown editor with WebBrowser control
- Dark mode & UI enhancements: Added dark mode, scroll sync, horizontal scrolling
- WebView2 migration: Replaced IE WebBrowser with Chromium WebView2
- Syntax highlighting: Integrated Highlight.js with custom Clarion support
- WebView2 Runtime Required: Users must have WebView2 Runtime installed (typically pre-installed on Windows 10/11)
- 32-bit Only: Built for x86 to match Clarion IDE architecture
- Print Feature: Print styles included but pagination needs work
- Multi-page print support
- Export to PDF
- Markdown templates
- Spell checking
- Find/Replace in editor
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT License - see LICENSE file for details.
- John Hickey - Original author
- Mark Sarson - WebView2 enhancements, Mermaid support
- Oleg Fomin - Document window mode feature
- Claude Code - AI pair programming assistant
From an idea by Dinko Bakun
This project bundles or depends on the following open source libraries — many thanks to the authors and maintainers of each:
- marked.js by Christopher Jeffrey and contributors (MIT License) — markdown → HTML parser
- Highlight.js by Ivan Sagalaev and contributors (BSD-3-Clause License) — code syntax highlighting
- Mermaid by Knut Sveidqvist and contributors (MIT License) — diagrams and flowcharts from text
- WebView2 by Microsoft — embedded Chromium runtime
- Custom Clarion syntax highlighting from discourse-highlightjs-clarion
Other inspirations and thanks:
- Built for the Clarion IDE (SharpDevelop-based)
- Inspired by popular markdown editors like Typora and Mark Text
- ClarionLive — Clarion developer community