Skip to content Skip to sidebar Skip to footer

Mvc Razor View: Output Text As Both Raw And Html Parsed?

I am having a hard time figuring out how to do this... I am essentially saving a huge blog post in a property called 'Body' in a class called 'Post'. In body I will have various t

Solution 1:

So for those that are still having this issue, this is how I resolved it.

1) I included prettyprint. See link below

https://google-code-prettify.googlecode.com/svn/trunk/README.html

2) When editing a post I just add the following code //Bunch of code

Example: var http = require("http");

var server = http.createServer(function(req, res){
console.log(req.url);
resp.write("<html><body>" + req.url + "</html></body>");
resp.end();
});

server.listen(3000);

</pre>

In my Razor View I have the following code:

<div class="blog margin-bottom-40" onload="prettyPrint()">
//Bunch of other code up here for my view<divclass="blogpost">
        @Html.Raw(post.Body)
    </div>
</div>

My blog is www.techiejs.com

Feel free to have a look and if you need another file from my solution let me know. Currently my git repository is private.

Post a Comment for "Mvc Razor View: Output Text As Both Raw And Html Parsed?"