whiteMongoosemain.tsx1 match
2import { renderToString } from "npm:react-dom/server";
34export default async function(req: Request) {
5return new Response(
6renderToString(
markdown_downloadmain.tsx9 matches
15* @returns markdown in string
16*/
17export async function html2markdown(html: string): Promise<string> {
18if (AgentMarkdownImport) {
19// TurndownService doesn't work on cf
32* @returns markdown in string
33*/
34export async function readability2markdown(html: string): Promise<{ title: string; markdown: string }> {
35const doc = await (new DOMParser().parseFromString(html, "text/html"));
3642}
4344function getYoutubeVideoID(url: URL): string | null {
45const regExp = /(?:youtube\.com\/(?:[^/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?/\s]{11})/i;
46const match = url.href.match(regExp);
48}
4950function response(message: string, contentType = "text/markdown"): Response {
51const headers = new Headers();
52headers.set("Access-Control-Allow-Origin", "*");
61}
6263function err(msg: string): Response {
64const errorMessage = JSON.stringify({
65error: {
71}
7273function fudgeURL(url: string) {
74try {
75return new URL(url);
80}
8182function processInput(req: Request) {
83let ret = {
84url: undefined as undefined | URL,
107}
108109export default async function(req: Request): Promise<Response> {
110const action = processInput(req);
111const url = action.url;
181* Simple UI that takes a url
182*/
183export function generate_ui(input_description: string, link: string, link_text: string): string {
184const html = `
185<!DOCTYPE html>
MarkdownCommandmain.tsx1 match
5import { def_from_simple } from "https://raw.githubusercontent.com/curtcox/CommandInterpreter/main/command/ToolsForCommandWriters.ts";
67async function markdown(url: string) {
8const encoded = encodeURIComponent(url);
9const response = await fetch(`https://markdown.download/?url=${encoded}`);
valTownLogotypeReactmain.tsx1 match
2import React from "npm:react";
34export default function ValTownLogo(props: React.SVGProps<SVGSVGElement>) {
5return (
6<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 442 79" {...props}>
valTownSearchmain.tsx1 match
5const githubQuery = (query: string) => encodeURIComponent(`${query} repo:pomdtr/val-town-mirror path:vals/`);
67async function handler(req: Request) {
8const url = new URL(req.url);
9
2import { render } from "npm:preact-render-to-string";
34export default async function(req: Request) {
5return new Response(
6render(
1# Render form and save data
23This val provides a web-based interface for collecting email addresses. It features a dual-functionality approach: when accessed via a web browser using a GET request, it serves an HTML form where users can submit their email address. If the script receives a POST request, it implies that the form has been submitted, and it proceeds to handle the incoming data.
45Fork this val to customize it and use it on your account.
weatherGPTmain.tsx1 match
31console.log(text);
3233export async function weatherGPT() {
34await email({ subject: "Weather Today", text });
35}
5import { Hono } from "npm:hono@3";
67function esmTown(url) {
8return fetch(url, {
9headers: {
92});
9394export async function calorieEstimate(file: File) {
95const dataURL = await fileToDataURL(file);
96try {
1export default async function(req: Request): Promise<Response> {
2if (req.method === "OPTIONS") {
3return new Response("ok");