-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconvert.js
51 lines (42 loc) · 1.09 KB
/
convert.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
46
47
48
49
50
51
const fs = require('fs');
const MarkdownIt = require('markdown-it');
let styles = fs.readFileSync('style.css', 'utf8');
let openingFile = fs.readFileSync('opening.md', 'utf8');
let tasksFile = fs.readFileSync('tasks.md', 'utf8');
let closingFile = fs.readFileSync('closing.md', 'utf8');
tasksFile = tasksFile.replace(/- \[ \]/g, '- ☐');
const md = new MarkdownIt();
const opening = md.render(openingFile);
const tasks = md.render(tasksFile);
const closing = md.render(closingFile);
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
${styles}
</style>
</head>
<body>
<div class="markdown-body">
${opening}
<hr>
<div class="container">
<div class="list-column">
<h2>✅ Aufgaben</h2>
${tasks}
</div>
<div class="notes-column">
<h2>📝 Notizen</h2>
</div>
</div>
<hr>
${closing}
</div>
</body>
</html>
`;
// Write the styled HTML to a file
fs.writeFileSync('output.html', htmlContent);
console.log("Markdown converted to HTML with custom styling and optimized font sizes.");