* hallo.js: Use a forked Hallo.js * showdown.js: * to-markdown.js: * mdd_gripper.png: * mdd_toolbar.png: * mdd_modal_background.png: The client side Markdown is now implemented using Hallo.js * FontAwesome.otf: * fontawesome-webfont.eot: * fontawesome-webfont.svg: * fontawesome-webfont.ttf: * fontawesome-webfont.woff: * fontawesome-webfont.woff2: awesome * MarkdownDeep.dll: a modified version to render video and audio tags * NpgsqlBlogProvider.cs: * CalendarController.cs: * WorkFlowController.cs: refactoring: The `UserName` property from the `BlogEntry` class is renamed to `Author` * InputUserName.cs: formatting * BlogsController.cs: * refactoring: The `UserName` property from the `BlogEntry` class is renamed to `Author` * Fixes pandoc process on file named with some spaces * BlogsController.cs: UserName became Author on BlogEntry objects * Global.asax.cs: route /fonts is now ignored. * MarkdownHelper.cs: transform Markdown using a given base url * App.master: jquery was not needed on all pages. * Edit.aspx: using Hallo.js * BlogEntry.cs: * UserPost.aspx: * UserPosts.aspx: * BlogManager.cs: * RemoveTitle.aspx: * BlogEntryCollection.cs: * UUBlogEntryCollection.cs: * UUTBlogEntryCollection.cs: refactoring * Web.config: ? * Web.csproj: * use my local assembly for MarkdownDeep.dll * fontawesome integration * Hallo.js, to-markdown.js, showdowwn.js integration * packages.config: Now use forked MarkdownDeep * MarkdownDeepLib.min.js: * MarkdownDeep License.txt: * MarkdownDeep Quick Reference.txt: using my local revision * mdd_ajax_loader.gif: The client side Markdown is now implemented using Hallo.js
58 lines
2.2 KiB
C#
58 lines
2.2 KiB
C#
using System.Web;
|
|
using System.Web.Mvc;
|
|
using MarkdownDeep;
|
|
|
|
namespace Yavsc.Helpers
|
|
{
|
|
/// <summary>
|
|
/// Helper class for transforming Markdown.
|
|
/// </summary>
|
|
public static partial class MarkdownHelper
|
|
{
|
|
/// <summary>
|
|
/// Transforms a string of Markdown into HTML.
|
|
/// </summary>
|
|
/// <param name="text">The Markdown that should be transformed.</param>
|
|
/// <returns>The HTML representation of the supplied Markdown.</returns>
|
|
public static IHtmlString Markdown(string text)
|
|
{
|
|
// Transform the supplied text (Markdown) into HTML.
|
|
var markdownTransformer = new Markdown();
|
|
markdownTransformer.ExtraMode = true;
|
|
string html = markdownTransformer.Transform(text);
|
|
|
|
// Wrap the html in an MvcHtmlString otherwise it'll be HtmlEncoded and displayed to the user as HTML :(
|
|
return new MvcHtmlString(html);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Transforms a string of Markdown into HTML.
|
|
/// </summary>
|
|
/// <param name="helper">HtmlHelper - Not used, but required to make this an extension method.</param>
|
|
/// <param name="text">The Markdown that should be transformed.</param>
|
|
/// <param name="urlBaseLocation">The url Base Location.</param>
|
|
/// <returns>The HTML representation of the supplied Markdown.</returns>
|
|
public static IHtmlString Markdown(this HtmlHelper helper, string text, string urlBaseLocation="")
|
|
{
|
|
// Transform the supplied text (Markdown) into HTML.
|
|
var markdownTransformer = new Markdown();
|
|
markdownTransformer.ExtraMode = true;
|
|
markdownTransformer.UrlBaseLocation = urlBaseLocation;
|
|
string html = markdownTransformer.Transform(text);
|
|
// Wrap the html in an MvcHtmlString otherwise it'll be HtmlEncoded and displayed to the user as HTML :(
|
|
return new MvcHtmlString(html);
|
|
}
|
|
/// <summary>
|
|
/// Transforms a string of Markdown into HTML.
|
|
/// </summary>
|
|
/// <param name="helper">HtmlHelper - Not used, but required to make this an extension method.</param>
|
|
/// <param name="text">The Markdown that should be transformed.</param>
|
|
/// <returns>The HTML representation of the supplied Markdown.</returns>
|
|
public static IHtmlString Markdown(this HtmlHelper helper, string text)
|
|
{
|
|
// Just call the other one, to avoid having two copies (we don't use the HtmlHelper).
|
|
return Markdown(text);
|
|
}
|
|
}
|
|
}
|