Make <script> markups contained in the Markdown run
This commit is contained in:
parent
85b71262be
commit
a320aa9621
1 changed files with 9 additions and 1 deletions
|
@ -32,9 +32,17 @@ function DomRenderer(modules) {
|
|||
}
|
||||
|
||||
function getDiv(markdown) {
|
||||
return modules.dom.make('div', {
|
||||
var d= modules.dom.make('div', {
|
||||
innerHTML: modules.md.render(markdown)
|
||||
});
|
||||
var scripts = d.getElementsByTagName('script');
|
||||
for(var i = 0; i < scripts.length; i++) {
|
||||
var run = modules.dom.make('script',
|
||||
{type: 'text/javascript', src: scripts[i].src, textContent: scripts[i].textContent}
|
||||
);
|
||||
scripts[i].parentNode.replaceChild(run, scripts[i]);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
function article(key, markdown, limit) {
|
||||
|
|
Loading…
Reference in a new issue