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 miliseconds.
A simple Val Town application that fetches and displays random pages from the C2 Wiki (https://wiki.c2.com) using their FedWiki endpoint and markup renderer. Each page load shows a different random wiki page.
- Server-side rendering of random C2 Wiki pages
- Uses 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 with TailwindCSS styling
- Automatic WikiWord linking (CamelCase words link to their respective C2 Wiki pages)
- Simple refresh-to-get-new-page functionality
- 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
- Server-Side Rendering: Generates complete HTML page with embedded content
backend/index.ts
- Single Hono server that fetches wiki content and serves complete HTML pages
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
Simply visit the page to see a random C2 Wiki page. Click "Get Another Random Page" or refresh to see a different random page.