script.jsexport function convert(basename, image, index, {created, updated, start = false, end = false, text} = {}) {
const title = `${basename} ${index}`;
const prevTitle = start ? '' : `[${basename} ${index - 1}]`;
const nextTitle = end ? '' : `[${basename} ${index + 1}]`;
const quotes = text?.split?.(/\n/)?.map?.(line => `>${line}`) ?? [];
return {
title,
...(created ? {created} : {}),
...(updated ? {updated} : {}),
lines: [
title,
`<=${prevTitle} | ${nextTitle}=>`,
`[[${image}]]`,
...quotes,
],
};
}