cohost/html/read-more.tsx

20 lines
514 B
TypeScript
Raw Normal View History

2023-12-30 01:39:37 -05:00
import { render_and_copy } from "./common.tsx";
const DICK_URL = "https://www.gutenberg.org/files/2701/old/moby10b.txt";
const text = await fetch(DICK_URL).then(r => r.text());
render_and_copy(
<div>
{text
.split(/CHAPTER|Epilogue/)
.slice(1)
.map(c => (
<>
{...c
.split("\r\n\r\n")
.map(p => <p>{p.replaceAll("\r\n", " ")}</p>)}
</>
))}
</div>
);