-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusage.js
More file actions
61 lines (58 loc) · 1.8 KB
/
usage.js
File metadata and controls
61 lines (58 loc) · 1.8 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
const fs = require('fs');
const path = require('path');
const remark = require("remark");
const html = require('remark-html')
const externalPreview = require("./index");
const Handlebars = require("handlebars");
const previewTemplate = fs.readFileSync(path.resolve("./templates/github.hbs"), 'utf8')
const template = Handlebars.compile(previewTemplate);
const preview = template(
{
config: {
container: {
class_prefix: "external-preview",
class1: "flex flex-align-top",
class2: "frame",
add_header: true,
header: {
class: "header flex hide-for-small",
add_dots: true,
dots: {
class: "buttons",
count: [1, 2, 3]
},
add_title: true,
title: {
add_link: true,
class: "header-title"
}
},
code: {
use_prism: true,
class: "code",
}
},
github: {
only_selected_lines: true,
replacement_host: "raw.githubusercontent.com"
}
},
data: {
content: "Test",
language: "yml",
link: "https://adapttive.com"
}
}
);
//console.log(preview)
remark()
.use(html)
.use(externalPreview)
.process(
"# Hi" +
"\n[@external:code:github](https://github.com/milindsingh/magento2-grumphp/blob/2d9be8cf5c9da07256af5194370e9a9326e30881/module/grumphp.yml#L1-L134)",
function(err, output) {
console.log(String(output))
console.error(err)
}
);