Public
Readme
Generate fake doc pages for testing in Starlight with its built in components and hacker jargon from Faker.
If you are looking to add the required title
frontmatter for a batch of files you can use this python script to interpret the title
from the filename.
Code
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import ReactMarkdown from "https://esm.sh/react-markdown";
import remarkGfm from "https://esm.sh/remark-gfm";
import { faker } from "https://esm.sh/@faker-js/faker";
function App() {
const [markdown, setMarkdown] = useState("");
const generateLoremIpsum = () => {
const validIconNames = [
'up-caret', 'down-caret', 'right-caret', 'right-arrow', 'left-arrow', 'bars', 'translate', 'pencil', 'pen', 'document',
'add-document', 'setting', 'external', 'moon', 'sun', 'laptop', 'open-book', 'information', 'magnifier', 'forward-slash',
'close', 'error', 'warning', 'approve-check-circle', 'approve-check', 'rocket', 'star', 'puzzle', 'list-format', 'random',
'comment', 'comment-alt', 'heart', 'github', 'gitlab', 'bitbucket', 'codePen', 'farcaster', 'discord', 'gitter',
'twitter', 'x.com', 'mastodon', 'codeberg', 'youtube', 'threads', 'linkedin', 'twitch', 'azureDevOps', 'microsoftTeams',
'instagram', 'stackOverflow', 'telegram', 'rss', 'facebook', 'email', 'reddit', 'patreon', 'signal', 'slack',
'matrix', 'hackerOne', 'openCollective', 'blueSky', 'discourse', 'zulip', 'pinterest', 'tiktok', 'astro', 'alpine',
'pnpm', 'biome', 'bun', 'mdx', 'apple', 'linux', 'homebrew', 'nix', 'starlight', 'pkl', 'node', 'cloudflare',
'vercel', 'netlify', 'deno', 'jsr'
];
const frontmatter = `---
title: ${faker.hacker.phrase().slice(0, 25)}
---
`;
const generateBodyText = () => `${faker.hacker.phrase()}. ${faker.hacker.phrase()}. ${faker.hacker.phrase()}.\n\n`;
const generateCodeBlock = () => {
const lang = faker.helpers.arrayElement(['js', 'ts', 'python', 'rust', 'go', 'java', 'cpp']);
const fileName = `${faker.system.fileName()}.${lang}`;
const codeContent = faker.hacker.phrase() + '\n' + faker.hacker.phrase() + '\n' + faker.hacker.phrase();
return `<Code code={\`${codeContent}\`} lang="${lang}" title="${fileName}" />\n\n${generateBodyText()}`;
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
kylem-starlightfaker.web.val.run
Updated: September 10, 2024