samengine 1.7.6 → 1.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/markdown.d.ts +1 -0
- package/dist/utils/markdown.js +12 -3
- package/package.json +1 -1
package/dist/utils/markdown.d.ts
CHANGED
|
@@ -36,5 +36,6 @@ export declare function parse(markdown: string, options?: ParseOptions): string;
|
|
|
36
36
|
export declare function parseToDocument(markdown: string, options?: ParseOptions & {
|
|
37
37
|
title?: string;
|
|
38
38
|
css?: string;
|
|
39
|
+
header?: string;
|
|
39
40
|
}): string;
|
|
40
41
|
export declare function exportcss(): string;
|
package/dist/utils/markdown.js
CHANGED
|
@@ -195,7 +195,11 @@ function parseTable(block, opts) {
|
|
|
195
195
|
const headerCells = rows[0]
|
|
196
196
|
.split(/(?<!\\)\|/)
|
|
197
197
|
.filter((_, i, a) => !(i === 0 && _ === "") && !(i === a.length - 1 && _ === ""))
|
|
198
|
-
.map((c) => c
|
|
198
|
+
.map((c) => c
|
|
199
|
+
.trim()
|
|
200
|
+
.replace(/\\\|/g, "|")
|
|
201
|
+
.replace(/\\\[/g, "[")
|
|
202
|
+
.replace(/\\\]/g, "]"));
|
|
199
203
|
const alignRow = rows[1].split(/(?<!\\)\|/).filter((c) => /[-:]/.test(c));
|
|
200
204
|
const aligns = alignRow.map((c) => {
|
|
201
205
|
c = c.trim();
|
|
@@ -217,7 +221,11 @@ function parseTable(block, opts) {
|
|
|
217
221
|
const cells = row
|
|
218
222
|
.split(/(?<!\\)\|/)
|
|
219
223
|
.filter((_, i, a) => !(i === 0 && _ === "") && !(i === a.length - 1 && _ === ""))
|
|
220
|
-
.map((c) => c
|
|
224
|
+
.map((c) => c
|
|
225
|
+
.trim()
|
|
226
|
+
.replace(/\\\|/g, "|")
|
|
227
|
+
.replace(/\\\[/g, "[")
|
|
228
|
+
.replace(/\\\]/g, "]"));
|
|
221
229
|
return `<tr>\n${cells
|
|
222
230
|
.map((c, i) => {
|
|
223
231
|
const align = aligns[i] ? ` style="text-align:${aligns[i]}"` : "";
|
|
@@ -620,7 +628,7 @@ export function parse(markdown, options = {}) {
|
|
|
620
628
|
* Gibt ein vollständiges HTML-Dokument zurück (optional mit eigenem CSS).
|
|
621
629
|
*/
|
|
622
630
|
export function parseToDocument(markdown, options = {}) {
|
|
623
|
-
const { title = "Dokument", css = defaultCss, ...parseOpts } = options;
|
|
631
|
+
const { title = "Dokument", header = "", css = defaultCss, ...parseOpts } = options;
|
|
624
632
|
const body = parse(markdown, parseOpts);
|
|
625
633
|
return `<!DOCTYPE html>
|
|
626
634
|
<html lang="de">
|
|
@@ -629,6 +637,7 @@ export function parseToDocument(markdown, options = {}) {
|
|
|
629
637
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
630
638
|
<title>${escapeHtml(title)}</title>
|
|
631
639
|
<style>${css}</style>
|
|
640
|
+
${header}
|
|
632
641
|
</head>
|
|
633
642
|
<body>
|
|
634
643
|
<article class="md-body">
|