#!/usr/bin/env node
import {marked} from 'marked'
import hljs from 'highlight.js'
import fs from 'node:fs'
import path from 'node:path'
import run from './html2pdf.mjs'
// import 'highlight.js/styles/github.css';
marked.setOptions({
renderer: new marked.Renderer(),
highlight: function(code, lang) {
const language = hljs.getLanguage(lang) ? lang : 'plaintext';
return hljs.highlight(code, { language }).value;
},
langPrefix: 'hljs language-', // highlight.js css expects a top-level 'hljs' class.
pedantic: false,
gfm: true,
breaks: false,
sanitize: false,
smartLists: true,
smartypants: false,
xhtml: false
});
const filePath = `${process.env.PWD}/${process.argv[2]}`
const markdownString = fs.readFileSync(filePath, 'utf8')
const fileName = `${filePath}`.replace('.md','.html')
let html = marked.parse(markdownString)
console.log(27, html);
html = html.replace(/!\[\[(.*)\]\]/g, '')
html = `