import { render_and_copy } from "./common.tsx"; const URL = "https://dn790009.ca.archive.org/0/items/thestrangecaseof00043gut/43.txt"; const text = (await fetch(URL).then(r => r.text())).replaceAll("\r", ""); const chapters: [string, string[]][] = text .replaceAll("`", "‘") .replaceAll("'", "’") .replaceAll("--", "—") .split("\n\n\n\n\n") .slice(1) .map(c => c.split("\n\n\n")) .filter(c => c.length == 2) .map(c => [c[0], c[1].split("\n\n")]); const make_chapter_id = (title: string) => title .toLowerCase() .split(" ") .map(w => w.split(/[^a-z]/).join("")) .join("-"); console.log(chapters); render_and_copy( <>
massive thanks to project gutenberg for the book
JUMP TO END

Table of Contents (clickable!)

    {...chapters.map(([title, _]) => (
  1. {title}
  2. ))}


{...chapters.map(([title, content]) => ( <> {title} {...content.map(p =>

{p}

)} ))} THE END
{ "\n\n---\n\nsorry for abusing the read more, but it's necessary to make saving your place more convenient" } );