Scrapbox書籍のformat@0.1.0
code:sb
title.pdf {pageNumber}
PDF or OCR text
...
前後へのリンクは先頭行でもいいかも
変換用関数
code:script.js
export 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,
],
};
}
code:script.d.ts
export function convert(basename: string, image: string, index: number, options: {
created?: number;
updated?: number;
start: boolean;
end: boolean;
text?: string,}): {
title: string;
created?: number;
updated?: number;
lines: string[];
};