added save to pdf operation/cleanup

This commit is contained in:
Kutaz 2023-01-09 13:46:13 -05:00
parent 84aafe76ab
commit e03a138aa2
2 changed files with 4 additions and 27 deletions

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs";
import MarkdownIt from "markdown-it";
import hljs from "highlight.js";
import { jsPDF } from "jspdf";
/**
* Render Markdown operation
@ -32,12 +31,6 @@ class RenderMarkdown extends Operation {
type: "boolean",
value: false
},
{
name: "Print to PDF",
type: "boolean",
value: false
},
{
name: "Enable syntax highlighting",
type: "boolean",
@ -52,7 +45,7 @@ class RenderMarkdown extends Operation {
* @returns {html}
*/
run(input, args) {
const [convertLinks, printto, enableHighlighting] = args,
const [convertLinks, enableHighlighting] = args,
md = new MarkdownIt({
linkify: convertLinks,
html: false, // Explicitly disable HTML rendering
@ -60,30 +53,16 @@ class RenderMarkdown extends Operation {
if (lang && hljs.getLanguage(lang) && enableHighlighting) {
try {
return hljs.highlight(lang, str).value;
} catch (__) {
}
}
}
return "";
}
}),
rendered = md.render(input);
return `<div style="font-family: var(--primary-font-family)">${rendered}</div>`;
}

View file

@ -543,9 +543,7 @@ class OutputWaiter {
if (fileName === null) return;
const data = await dish.get(Dish.HTML);
//const printdata = '<meta name="viewport" content="width=900px, initial-scale=0.1" />'
//const realdata = printdata + data
console.log(data, "this is our html")
//console.log(data, "this is our html")
var doc = new jsPDF('p', 'px', 'a4');
const width = doc.internal.pageSize.getWidth();