In this tutorial, you will learn a little about Markdown and how you can use it with Umbraco CMS. For anyone who has written a lot of content using Umbraco using the normal rich-text editor, it is very likely you will have encountered one or more of these issues.
- Content copied from word carries in unwanted HTML
- You high-light something from the editor and it is not applied correctly, so you manually copy it
- To make text look how you want, you spend more time in the view source mode than writing content
- You like markdown
In general, writing and managing content within HTML is a bit clunky. When you write your content in Markdown, in general it allows you to focus on the writing.
How To Add The Markdown Onto An Umbraco Page
Out of the box, Umbraco comes with a Markdown editor. If you go into the backend, click on the settings ribbons and then go to Document types, if you randomly pick an existing people to try to add a new property onto a document type, from the list you will see Markdown Editor, like so:
After the markdown editor has been added to a document type, the next time a content editor tries to create a new page using it, they will see this:
Within your pages controller, or view model you can then use the normal Umbraco API to render it.
IPublishedContent page = // get page;
var html = content.GetPropertyValue