Example of Overview in ASP.NET MVC Markdown Editor Control
This example illustrates how to preview Markdown changes within the Markdown Editor. You can input or modify the display text, apply formatting, and observe the Markdown preview alongside. A bar between the editor and the preview resizes them.
@* The editor's settings are in the view; the data they read (ViewData) is set in the controller action (see the controller tab). *@
@Html.UiMarkdownEditor(new UiMarkdownEditorOptions
{
Id = "overviewEditor",
Height = "450px",
Placeholder = "Enter your text here...",
SaveInterval = 1,
MaxLength = 5000,
ShowCharCount = true,
ShowPreview = true,
PreviewTitle = "Markdown Preview",
ResizablePreview = true,
ToolbarSettings = new UiMarkdownToolbar { Items = (List<string>)ViewData["Tools"] },
Value = (string)ViewData["MDValue"]
})
@Html.UiMarkdownEditor(new UiMarkdownEditorOptions
{
Id = "overviewEditor",
Height = "450px",
Placeholder = "Enter your text here...",
SaveInterval = 1,
MaxLength = 5000,
ShowCharCount = true,
ShowPreview = true,
PreviewTitle = "Markdown Preview",
ResizablePreview = true,
ToolbarSettings = new UiMarkdownToolbar { Items = (List<string>)ViewData["Tools"] },
Value = (string)ViewData["MDValue"]
})
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class MarkdownEditorController : Controller
{
// The page is Views/MarkdownEditor/Overview.cshtml; it draws what ViewData holds.
public ActionResult Overview()
{
ViewData["Tools"] = new List<string>
{
"Bold", "Italic", "StrikeThrough", "|", "Formats", "Blockquote", "OrderedList", "UnorderedList", "|", "CreateTable", "CreateLink", "Image", "|", "Undo", "Redo"
};
ViewData["MDValue"] = @"## Welcome to the Lumen Markdown Editor
The **Markdown Editor** delivers a lightweight, distraction-free editing experience with full Markdown syntax support — the preview is made by the library itself.
Write beautiful documents faster using simple, readable Markdown syntax and see the formatted result instantly with live preview.
### Why Choose Markdown Mode?
- Clean, plain-text syntax that is easy to read and write — even in raw form
- Input or modify text, apply formatting, and view the Markdown preview side-by-side.
- Toolbar + keyboard shortcuts for rapid formatting
- Easy to convert content to HTML or other formats
- Ideal for documentation, notes, and developer-focused content
- Reduces clutter and keeps the writing experience distraction-free
### Supported Markdown Features in Action
# Headings
## Markdown Editor Demo
### Create Clean, Structured Content
#### Organize Sections Effortlessly
##### Add Subheadings for Clarity
###### Provide Notes or Additional Info
Headings help structure your content, making it easier to read, scan, and organize information within the Markdown editor.
#### Text Formatting
**Bold text highlights important information.**
*Markdown makes writing simple and clean.*
**_You can also combine bold and italic for emphasis._**
~~Use strikethrough to indicate removed or outdated content.~~
`Inline code is perfect for short code snippets like commands or variables.`
### Table
Create simple tables to organize information clearly and quickly.
| Feature | Description |
|---------|-------------|
| Markdown | Lightweight, easy-to-read formatting syntax |
| Preview | Shows formatted output side-by-side |
#### Lists
**Unordered**
- Explore the editor features
- Add content with simple syntax
- Insert nested bullet points
- Organize topics hierarchically
- Keep your notes clear and readable
**Ordered**
1. Start writing your content
2. Apply Markdown formatting
1. Add sub-steps for detailed tasks
2. Improve clarity with structure
3. Review and finalize your document
**Task List**
- [x] Completed task
- [ ] Write documentation
- [ ] Release new version
#### Blockquotes
> Markdown makes writing on the web beautiful and readable.
>
> — John Gruber, Creator of Markdown
#### Code Blocks
Inline code: Use `dotnet add package Lumen.UI.Mvc`";
return View();
}
}
}
@* Install once: Install-Package Lumen.UI.Mvc (or: dotnet add package Lumen.UI.Mvc) *@
@* Views/Web.config: <add namespace="Lumen.UI.Mvc" /> *@
@* Views/Shared/_Layout.cshtml *@
<head>
@Html.UiStyles()
<link rel="stylesheet" href="~/Content/site.css" />
</head>
<body>
@RenderBody()
@Html.UiScripts()
@RenderSection("scripts", required: false)
</body>
The Markdown Editor provides the ability to instantly preview Markdown changes. ShowPreview shows the preview next to the
text, PreviewTitle gives it a heading and ResizablePreview adds a bar between the two that you drag (or move with the arrow
keys) to resize them. The preview is made by the library itself, and it is made safe: scripts and styles in the text never run.