Convert Markdown to HTML in JS
This commit is contained in:
parent
0bb872162b
commit
8893cf83ed
2 changed files with 4 additions and 2 deletions
|
|
@ -38,7 +38,9 @@ function stacosys_load() {
|
|||
// Response handlers.
|
||||
xhr.onload = function() {
|
||||
var jsonResponse = JSON.parse(xhr.responseText);
|
||||
console.log(jsonResponse);
|
||||
for (var i = 0, numTokens = jsonResponse.data.length; i < numTokens; ++i) {
|
||||
jsonResponse.data[i].mdcontent = markdown.toHTML(jsonResponse.data[i].content);
|
||||
}
|
||||
var template = document.getElementById('stacosys-template').innerHTML;
|
||||
var rendered = Mustache.render(template, jsonResponse);
|
||||
document.getElementById('stacosys-comments').innerHTML = rendered;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue