This project is read-only.

Paragraphs Field using Markdown

Topics: Administration, Customizing Orchard, Writing modules
Aug 30, 2013 at 7:36 AM
Edited Aug 30, 2013 at 7:37 AM
I want to allow markdown text to be styled while keeping the editorial part for my customer as simple as possible (hence the idea to use Markdown text)

I was thinking to create a new ContentField called Paragraphs that allows me to create multiple Markdown-enabled text fields on a content type. This way, I can stylize paragraphs by encapsulating each paragraph of Markdown text with a div containing a class. I was thinking to simply serialize the different paragraph fields into a JSON object into the storage associated with ContentField, and then add Display and Editor Templates to be able to Add and Remove Paragraphs and on the front-end simply loop through my JSON object to spit out the paragraph divs with their containing Markdown text.

I'm just not quite sure if there might be a better way to accomplish this, maybe by extending the Markdown syntax to parse a paragraph indicator into a stylized div or something. Any suggestions?
Aug 30, 2013 at 7:59 AM
I'd go with the idea of using a custom delimiter.
Aug 30, 2013 at 9:35 AM
Ok, thanks for the feedback. I already found out the replacement is taking place in MarkdownFilter. Is there some way for me to override that filter in my own Module? I'd rather not update the core module?
Aug 30, 2013 at 12:10 PM
Ok, just created an IHtmlFilter in my module and it got picked up nicely. I just love the way Orchard works!