I'd like to make a Markdown data type and was wondering how to change the data types output at render only on the front end.
I've seen the tutorials on nibble for creating custom data types, but the problem is, i need to change what is output at the point it is rendered on the front end, but maintain it's raw state during editing.
The easiest way would be to
- add post parsing in the Save method to store the data that's supposed to be used on the front end (ie so it's html and not markdown that's saved)
- Convert the html 2 markdown before the render method in your control
The optimal way would be to
- leave the control to use and store markdown
- override the ToXml() method on the IData class in your control to convert markdown to html when it's published (look at the related links data type in the editorControls project for inspiration)
Hope this helps! I'd love to see a markdown data type in the core, so if you're willing to add this to the core distribution I'd be happy to help you move on :-)
In terms the markdown tranformer, I've used the Markdown.NET library as written by Milan Negovan which you can find here
The zip should include all of the source code as well as all assemblies referenced so it should be everything you need, aswell as compiled binaries ready for you to install.
Markdown Data Type (Help please)
Hi Guys,
I'd like to make a Markdown data type and was wondering how to change the data types output at render only on the front end.
I've seen the tutorials on nibble for creating custom data types, but the problem is, i need to change what is output at the point it is rendered on the front end, but maintain it's raw state during editing.
Anbody got any advice on the best way to do this?
Many thanks
Matt
The easiest way would be to
- add post parsing in the Save method to store the data that's supposed to be used on the front end (ie so it's html and not markdown that's saved)
- Convert the html 2 markdown before the render method in your control
The optimal way would be to
- leave the control to use and store markdown
- override the ToXml() method on the IData class in your control to convert markdown to html when it's published (look at the related links data type in the editorControls project for inspiration)
Hope this helps! I'd love to see a markdown data type in the core, so if you're willing to add this to the core distribution I'd be happy to help you move on :-)
/n
Just throwing in a link for thread readers who wonders what Markdown is:
http://en.wikipedia.org/wiki/Markdown
Cool,
Thanks for the help hartvig, thats exactly the starting point I needed.
I'd be more than happy for anything I develop to be added to the core. I'll keep you posted of my progress.
Many thanks
Matt
Ok, here it is, let me know what you think.
http://www.mattbrailsford.com/downloads/mbumbracodatatypes_markdown.zip
In terms the markdown tranformer, I've used the Markdown.NET library as written by Milan Negovan which you can find here
The zip should include all of the source code as well as all assemblies referenced so it should be everything you need, aswell as compiled binaries ready for you to install.
All the best
Matt
In case anyone stumbles on this thread, I think Matt's code ended up forming the basis of Lee Kelleher's Markdown Editor package:
http://our.umbraco.org/projects/backoffice-extensions/markdown-editor
TinyMCE is living hell, so I vote with Niels to add Markdown to the core! :)
is working on a reply...