Copied to clipboard

Flag this post as spam?

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


  • Charles Roper 48 posts 200 karma points
    Mar 17, 2016 @ 15:18
    Charles Roper
    0

    How do I prevent automatic Markdown processing?

    I'm using Markdown in a small project I'm working on and was following Stephen's advice found here on the forum, but with CommonMark.NET instead of MarkdownDeep.

    However, I noticed my HTML was getting double rendered, so I changed my view so it's not using a processor. Sure enough, my Markdown is being converted into HTML automagically without the need to process it myself, even if I do something like this:

    @{
        var bodyText = Model.Content.GetPropertyValue<string>("bodyText");
    }
    @Html.Raw(bodyText)
    

    Is this something recently introduced? It makes sense that Umbraco does this, but in my case I'd like to use CommonMark instead of MarkdownSharp. So my question is, how do I stop it from rendering Markdown automatically? I know I can just use a textarea instead, but the Markdown editor is kinda nice to have.

    Many thanks!

    Charles

  • Lars-Erik Aabech 339 posts 1083 karma points MVP 4x c-trib
    Mar 18, 2016 @ 09:57
    Lars-Erik Aabech
    1

    Hi,

    I'm not entirely sure you can override the default property value converters, but you can try making one for the markdown datatype. Use the builtin property editor alias in IsConverter method. (See below)

    Otherwise, you can copy everything into your own property editor and make a property value converter that uses CommonMark.NET instead.

    Info on value converters here: https://our.umbraco.org/documentation/extending/property-editors/value-converters

    And some info on how we had to do it before the current converter was builtin: http://www.zpqrtbnk.net/posts/markdown-in-umbraco

    HTH, Lars-Erik

  • Charles Roper 48 posts 200 karma points
    Mar 23, 2016 @ 12:57
    Charles Roper
    0

    I discovered how to do this. The answer was in the bug tracker (U4-7603).

    @{var rawMarkup = Model.Content.GetPropertyValue<string>("markup");}
    @rawMarkup
    
Please Sign in or register to post replies

Write your reply to:

Draft