-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstackedit.js
More file actions
74 lines (64 loc) · 2.68 KB
/
Copy pathstackedit.js
File metadata and controls
74 lines (64 loc) · 2.68 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
userCustom.onPreviewFinished = function() {
$('#preview-contents dd').each(function() {
$(this).html(function(index,html){
return html.replace(/\[ ?\]/g,'<i class="icon-check-empty"></i>');
});
$(this).html(function(index,html){
return html.replace(/\[X\]/ig,'<i class="icon-check"></i>');
});
});
$('#preview-contents li').each(function() {
$(this).html(function(index,html){
return html.replace(/\[ ?\]/g,'<i class="icon-check-empty"></i>');
});
$(this).html(function(index,html){
return html.replace(/\[X\]/ig,'<i class="icon-check"></i>');
});
});
};
userCustom.onPagedownConfigure = function(editor) {
var previewContentsElt = document.getElementById('preview-contents');
editor.hooks.chain("onPreviewRefresh", function() {
['class', 'activity', 'usecase'].forEach(function(type) {
_.each(previewContentsElt.querySelectorAll('.prettyprint > .language-' + type), function(elt) {
var preElt = elt.parentNode;
var imgElt = $('<img>').attr({
src: 'http://yuml.me/diagram/plain/' + type + '/' + encodeURIComponent(elt.textContent.replace(/\n/g, ', '))
});
preElt.parentNode.replaceChild(imgElt[0], preElt);
});
});
});
};
/* Tentativa de uso ccom MERMAID
userCustom.onPagedownConfigure = function(editor) {
var head = document.getElementsByTagName('head')[0];
var js = document.createElement("script");
js.type = "text/javascript";
js.src = "https://cdn.rawgit.com/knsv/mermaid/0.5.1/dist/mermaid.min.js";
head.appendChild(js);
var js = document.createElement("script");
js.type = "text/javascript";
js.src = "https://cdn.rawgit.com/knsv/mermaid/0.5.1/dist/mermaidAPI.js";
head.appendChild(js);
js = document.createElement("script");
js.type = "text/javascript";
js.innerHTML="mermaid.initialize({startOnLoad:false});";
head.appendChild(js);
var previewContentsElt = document.getElementById('preview-contents');
editor.hooks.chain("onPreviewRefresh", function() {
['mermaid'].forEach(function(type) {
_.each(previewContentsElt.querySelectorAll('.prettyprint > .language-' + type), function(elt) {
// var preElt = elt.parentNode;
//
// var graph = mermaidAPI.render(elt.textContent);
// var nElt = document.createElement('div');
// nElt.className="mermaid";
// nElt.innerHTML = graph;
//
// preElt.parentNode.replaceChild(nElt, preElt);
});
});
});
};
*/