Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Gradiation 36 posts 21 karma points
    Feb 20, 2009 @ 23:55

    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


  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Feb 21, 2009 @ 13:32
    Niels Hartvig

    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 :-)


  • Simon Justesen 436 posts 203 karma points
    Feb 21, 2009 @ 13:58
    Simon Justesen

    Just throwing in a link for thread readers who wonders what Markdown is:

  • Gradiation 36 posts 21 karma points
    Feb 22, 2009 @ 15:07


    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


  • Gradiation 36 posts 21 karma points
    Feb 22, 2009 @ 21:07

    Ok, here it is, let me know what you think.

    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


  • Dan Okkels Brendstrup 101 posts 197 karma points
    Nov 09, 2011 @ 14:52
    Dan Okkels Brendstrup

    In case anyone stumbles on this thread, I think Matt's code ended up forming the basis of Lee Kelleher's Markdown Editor package:

    TinyMCE is living hell, so I vote with Niels to add Markdown to the core! :)

Please Sign in or register to post replies

Write your reply to: