Stackoverflows WMD 系统 - 我的输入在哪里变成 HTML?
我在文本区域中的输入在什么阶段从原始文本变为 HTML? 例如,假设我缩进 4 个空格
like this
,那么 WMD Showdown.js 将在我输入的文本区域下方正确呈现它。但是文本区域实际上仍然包含
like this
PHP 服务器端是否负责将 showdown.js 所做的所有相同内容翻译为在 SoF 数据库中永久为 HTML?
At what stage does my input in the textarea change from being this raw text, and become HTML?
For example, say I indent 4 spaces
like this
Then the WMD Showdown.js will render it properly below this textarea I type in. But the text area still literally contains
like this
So is PHP server side responsible for translating all the same things the showdown.js does to permanently be HTML in the SoF Database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里还有一些关于此的其他帖子,但基本上它的工作原理是这样的。 或者至少我在我的网站上使用 WMD 是这样做的; 如果您有兴趣查看我的 WMD 实现,请参阅我的个人资料。
showdown.js
在浏览器中实时运行(纯客户端 JavaScript;无 AJAX 或类似内容),为用户提供预览。showdown.js
将 Markdown 转换为 HTML。 理论上,您可以使用其他方法,但尝试在服务器上获得用户在客户端上看到的相同转换是有意义的,而不是您想要在服务器端执行的任何 HTML 标记过滤。这里有一些相关的帖子。
There are some other posts here about this, but basically it works like this. Or at least this is how I do it on my website using WMD; see my profile if you're interested in checking out my WMD implementation.
showdown.js
runs in real time in the browser (pure client-side JavaScript; no AJAX or anything like that) to give the user the preview.showdown.js
server-side to convert the Markdown to HTML. In theory you could use some other method but it makes sense to try to get the same transformation on the server that the user sees on the client, other than any HTML tag filtering you want to do server-side.Here are some related posts.
首先,StackOverflow 是基于 ASP.NET 构建的,但是本质上,富文本框中的字符会来回翻译。
Well first of all StackOverflow is built on ASP.NET, but yes essentially the characters in the rich text box gets translated back and forth.