-
Notifications
You must be signed in to change notification settings - Fork 0
/
marked.velocity
41 lines (39 loc) · 1.19 KB
/
marked.velocity
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
## Macro name: marked
## Macro title: Marked markdown content
## Categories: Formatting
## Description: Display markdown content in Github flavoured markdown via the marked.js engine.
## Visibility: to all users
## Icon URL: https://raw.githubusercontent.com/norganna/marked-usermacro/master/marked.png
## Documentation URL: https://help.github.com/articles/github-flavored-markdown/
## Macro has a body: Y
## Body processing: Unrendered
## Generates: HTML
##
## @noparams
##
## Developed by: Ken Allan (https://github.com/norganna)
## Date created: 2015-09-01
#set ($randomId="")
#macro(getRandomId)
#set ($string="")
#set ($rand=$string.class.forName("java.util.Random").getConstructor().newInstance())
#set ($randomId=$rand.nextInt(2147483647).toString())
#end
#getRandomId()
<div id="markedcontent_$randomId">
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.2/marked.min.js">
</script>
<script>
jQuery(function() {
jQuery('#markedcontent_$randomId').html(marked($jsonator.convert($body).serialize(),{
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: true,
smartLists: true,
smartypants: false
}));
});
</script>