This commit is contained in:
Reudy 2026-09-26 19:13:02 +02:00
commit 0ad405c26e
78 changed files with 9127 additions and 0 deletions

17
src/lib/pdf/format.ts Normal file
View file

@ -0,0 +1,17 @@
// Names of the embedded files that make up the source-of-truth layer.
export const ATTACH = {
manifest: 'papure/manifest.json',
markdown: (id: string) => `papure/pages/${id}.md`,
ink: (id: string) => `papure/pages/${id}.ink.json`,
source: (id: string) => `papure/sources/${id}.pdf`
};
export const FORMAT = 'papure';
export async function sha256Hex(bytes: Uint8Array, length = 24): Promise<string> {
const digest = await crypto.subtle.digest('SHA-256', bytes as BufferSource);
return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, '0'))
.join('')
.slice(0, length);
}