Public
Like
RandomWikiPage
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v12View latest version
A Val Town application that fetches and displays random pages from the C2 Wiki (https://wiki.c2.com) using their FedWiki endpoint and markup renderer.
- Fetches random pages from C2 Wiki's FedWiki endpoint at
https://c2.com/wiki/remodel/pages/ - Renders wiki markup using the official C2 markup.js module from
https://wiki.c2.com/markup.js - Clean, responsive interface for reading wiki content with TailwindCSS styling
- Automatic WikiWord linking (CamelCase words link to their respective C2 Wiki pages)
- Error handling and loading states
- Mobile-responsive design
- Random Page Selection: Fetches the RandomPages list from C2 Wiki's FedWiki endpoint
- Page Extraction: Parses the bullet-pointed list to extract individual page names
- Random Selection: Picks a random page from the available list
- Content Fetching: Retrieves the selected page's content via the FedWiki API
- Markup Rendering: Uses C2's official markup.js to convert wiki markup to HTML
- Display: Shows the rendered content with proper styling and WikiWord linking
backend/index.ts- Hono server that serves the frontend and provides API endpointsfrontend/index.html- Main HTML template with TailwindCSSfrontend/app.js- Frontend JavaScript for fetching and displaying contentfrontend/style.css- Custom styling for wiki content
GET /- Serves the main applicationGET /api/random- Fetches a random wiki page and returns rendered HTMLGET /frontend/*- Serves static frontend assets
The C2 markup.js module converts:
'''bold text'''→ bold text''italic text''→ italic text----→ horizontal rules- WikiWords (CamelCase) → automatic links to C2 Wiki pages
- Line breaks → proper paragraph formatting
The application automatically loads a random page on startup. Click "Get Random Page" to fetch a new random page from the C2 Wiki collection.