-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
31 lines (25 loc) · 818 Bytes
/
Copy pathscript.js
File metadata and controls
31 lines (25 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* public/script.js */
window.onload = function() {
//var converter = new showdown.Converter();
var marked = require('marked');
marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: true,
smartLists: true,
smartypants: false
});
var pad = document.getElementById('pad');
var markdownArea = document.getElementById('markdown');
var convertTextAreaToMarkdown = function(){
var markdownText = pad.value;
//var html = (marked(markdownText.toString()));
var html = marked(markdownText);
markdownArea.innerHTML = html;
};
pad.addEventListener('input', convertTextAreaToMarkdown);
convertTextAreaToMarkdown();
};