This repository has been archived on 2023-01-27. You can view files and clone it, but cannot push or open issues or pull requests.
cad/report/markdown.js
2022-10-15 19:16:08 +02:00

21 lines
804 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.reportMarkdown = void 0;
const path = require("path");
const lib_1 = require("../lib/");
const csv = require('csv-stringify/lib/sync');
exports.reportMarkdown = (data) => {
const image = (path) => `![](./${(encodeURI(path))})`;
const file = (path) => `[${path}](./${(encodeURI(path))})`;
const set = data.map((d) => [
`${image(path.parse(d.target).name + path.parse(d.target).ext)}`,
`${file(path.parse(d.src).name + path.parse(d.src).ext)}`,
]);
const csvString = csv(set, {
header: true,
delimiter: ',',
columns: { 'a': 'Thumbnail', 'b': 'File' }
});
return lib_1.csvToMarkdown(csvString);
};
//# sourceMappingURL=markdown.js.map