Project · 2022

P

P

A website to paste your text with syntax highlighting support.

Background

P (yes, it's just called P as in pi because I'm suck at naming things) is a website where you can paste code and save it. It's basically like a pastebin clone I don't know how else I would explain it.

This is meant to run on a Cloudflare Worker and it uses Cloudflare KV to store the pasted text. The paste result will expires after 7 days to save space.

Technical Details

You can give the url a suffix like a filename and it will highlight them accordingly using highlight.js. Currently it only support these languages because I intend to use this for my personal needs. It's also reduces the bundle size if I don't import languages that I don't use.

  • Typescript/Javascript

  • HTML, XML

  • CSS

  • Shell

  • Rust

  • Go

  • Elixir

  • Lua

  • JSON

  • SQL

  • Plain text

I initially thought of using Rust, but I didn't end up using it because I realised that the Rust adapter for Cloudflare KV is just wrapping the JavaScript adapter so there's a bunch of data type conversion back and forth, so in the end I chose Typescript instead.

Spectator

Jisho Lens