且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么不是MarkdownSharp编码我的HTML?

更新时间:2023-01-23 17:24:07

由于它变得清晰,***的实现包含相当多的定制,这是很耗时的测试和弄清楚,我决定去另一个方向。

我创建的是降价的一个子集,我自己简单的标记语言。开源项目是 HTTP://ultralight.$c$cplex.com/ 并你可以在 http://www.bucketsoft.com/ultralight/

看到一个工作示例>

该项目是一个JavaScript编辑器一个完整的ASP.NET MVC的解决方案。不像MarkdownSharp,HTML安全保证。 JavaScript的解析器使用了客户端和服务器端,以保证一致的标记(特别感谢侏罗纪JavaScript编译器)。这是一个美丽的东西只需维护该分析器一张价值codeBase的。

虽然该项目仍处于测试阶段,我用它在我自己的网站已经和它似乎很好,到目前为止是工作。

In my mind, one of the bigger goals of Markdown is to prevent the user from typing potentially malformed HTML directly.

Well that isn't exactly working for me in MarkdownSharp.

This example works properly when you have the extra line break immediately after "abc"...

But when that line break isn't there, I think it should still be HtmlEncoded, but that isn't happening here...

Behind the scenes, the rendered markup is coming from an iframe. And this is the code behind it...

<% 
var md = new MarkdownSharp.Markdown();
%>
<%= md.Transform(Request.Form[0]) %>

Surely I must be missing something. Oh, and I am using v1.13 (the latest version as of this writing).


EDIT (this is a test for ***'s implementation)

abc

this shouldn't be red

Since it became clear that the *** implementation contains quite a few customizations that could be time consuming to test and figure out, I decided to go another direction.

I created my own simplified markup language that's a subset of Markdown. The open-source project is at http://ultralight.codeplex.com/ and you can see a working example at http://www.bucketsoft.com/ultralight/

The project is a complete ASP.NET MVC solution with a Javascript editor. And unlike MarkdownSharp, safe HTML is guaranteed. The Javascript parser is used both client-side and server-side to guarantee consistent markup (special thanks to the Jurassic Javascript compiler). It's a beautiful thing to only have to maintain one codebase for that parser.

Although the project is still in beta, I'm using it on my own site already and it seems to be working well so far.