-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
harness.js
46 lines (32 loc) · 1.06 KB
/
harness.js
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
var unified = require('unified')
var markdown = require('remark-parse')
var remark2rehype = require('remark-rehype')
var html = require('rehype-stringify')
var report = require('vfile-reporter')
var vfile = require('to-vfile')
var terms = require('./src/index')
var processor = unified()
.use(markdown, { commonmark: true })
.use(terms)
.use(remark2rehype)
.use(html)
let text = `
# header with special {term} inside
also we want to:
- {{term2}} should be term2
- {term1}{{followed by term2}}
- more stuff and {{term2 also}}
- {I am a {{nested}} term to see what happens}
- {{I am a differently nested {term}}}
- {{I am a thirdly {nested} term}}
But also {we want to see if we can do a phrase that transends a
new line?}
`
let text3 = `{term1}{{followed by term2}}`
// let str = `{I am a {{differently}} nested {{term}}}`
let str = `{this special term needs to \\{\\{preserve\\}\\} curly braces}`
// console.log(str)
processor.process(vfile.readSync('test.md'), function (err, file) {
console.error(report(err || file))
console.log(String(file))
})