Is there an option to allow script or embed code in PageDown editor?

匿名 (未验证) 提交于 2019-12-03 09:52:54

问题:

I'm creating a blog using node.js and I'm still debating whether I'm going to use PageDown or stick to whatever I have at the moment.

The current Markdown editor that I have its allow the user to enter any code they want without any restriction and some people think that it is a bad idea to do so, but having that option enabled by default for my blog it is okay because its a single author blog, and the owner obviously would be the advance users.

I have come across an awesome editor like PageDown and now I really want to know if I can use some hook or some thing that I can disable the sanitizer so that if they want to insert some code in their blog post so they can do it as well.

Such as :

<video class="inline-content centered" src="http://people.mozilla.org/~rgiles/2013/khuey-cycle_collector-sd.webm" controls>   <track src="/assets/captions/cycle-collector.vtt" kind="subtitles" default /> </video>

At least they should see the video embed or even any iframe.

I want the live preview to also display the code as well, but not sure what or how I can do that.

回答1:

To answer my own question:

I have found out that in PageDown we have an option to use the converter without sanitizing.

        var converter = new Markdown.Converter();         var editor = new Markdown.Editor(converter);         editor.run();


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!