-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
33 lines (28 loc) · 905 Bytes
/
Copy pathtest.js
File metadata and controls
33 lines (28 loc) · 905 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
32
33
const { render, use, compile, parse } = require('./dist/dev');
use({
afterParser(tokens, setTokens) {
// const newTokens = [];
// for (let i = 0; i < tokens.length - 1; i ++) {
// const now = tokens[i];
// const next = tokens[i + 1];
// if (now.type === 'br') {
// if (next.type !== 'br') {
// newTokens.push(now);
// }
// } else {
// newTokens.push(now);
// }
// }
// console.log(newTokens)
// setTokens(newTokens);
}
});
const text = require('fs').readFileSync(
// '/Users/ecznlai/Desktop/git-rally/eczn-blog/React 中使用 Highcharts.md',
'./test.md',
'utf-8'
);
const res = render(text);
// res.forEach(e => console.log(e));
console.log(res);
// => '<br /><h1>I ❤️ Plugin</h1><p>HELLO, 😊</p><br />'