levity

# [Write!](index.html) [**Write!**](.) is an online text editor meant for (speed)writing practice - pretty much just a pretty textbox with a timer and wpm display. It is also able to save documents to my Neocities server using the Neocities API by way of a CORS proxy. You can do this too if you host a copy on your own server - see the **Persistence** section for some slapdash instructions. ## Usage - Write in markdown (ie with `_italics_` & `**bold**`) and switch to preview mode to see it rendered (which you can then copy and paste into a rich text editor if you want). - Start a new session to clear the notepad and reset the timer. - The timer automatically pauses in preview mode and automatically unpauses when you input text. - The timer and notepad contents are automatically backed up to your browser's localStorage, so as to persist through refreshes. ### Persistence By default notepad contents are only stored locally, meaning they are lost when starting a new session. Anyone can use the editor at https://levity.whimsy.fun/write in this way, and simply copy out the text you've written if you'd like to save it before starting a new session. If you're [authenticated](/auth) as me -- meaning you have my Neocities API key in your browser's localStorage -- the "Save" button in the toolbar will save the contents of the notepad to a file in the `/write` directory on _my_ Neocities server. This makes the editor truly portable (if you're me), in the same way as writing in the Neocities dashboard text editor. If you also have a Neocities site, you can host your own copy of this editor on your own server and use it the same way. You will need the following: - A paid Neocities account (necessary to use the API to upload files IIRC) - A [CORS proxy](https://github.com/isoaxe/cors-server/) (there are some free servers out there or I guess you can use mine if you're cool) The relevant files to copy from [levity.whimsy.fun](/) if you wanna set this up on your own Neocities server are: - `/write/index.html` -- this should be placed in its own directory on your server, you can call it `write` or something else - `/auth.html` -- this needs to be at the root of your server - `/scripts/utils.js` -- this should be placed at the same path, ie in a `scripts` folder at the root of your server This is not as self-contained as I'd like (we don't use most of the functions in `utils.js` and having to copy over the whole file shouldn't be necessary), but it should do the trick for now! If anyone does set this up on their own website I'd love to know about it!! ## Background I developed this over the course of NaNoWriMo 2024 (instead of actually writing any prose, naturally), so I guess it counts as my novel. I wanted a text editor that would ease the friction (for me, personally) between wanting to write and writing. I wanted something: - minimal - with markdown support - mobile-friendly - portable (ie i can access the same file from both my laptop and phone) - mine (not an external service) - somehow able to encourage me to write more Up til now I'd been mostly using the Neocities dashboard / file editor (and sometimes the notes app in my phone) for my serious writing. Frankly, that would've been perfectly adequate for churning out a shitty novel as quickly as possible, but I started this project anyway as a form of procrastination, telling myself it would just be small and simple and quick, just a minimal little notepad so I could Write More Efficiently. A dozen hours later, I realized I had just spent a dozen hours on what was functionally inferior to the Neocities editor and ergonomically inferior to the notes app on my phone. I was bummed about this for a minute, until I realized that the solution was to spend a dozen more hours making the editor more functional, so I added a timer and word count display and then spent a further dozen hours refactoring and improving it. At this point I thought my little speedwriting app was pretty neat, but I still couldn't bring myself to actually use it -- it felt too ephemeral, with still no way to save my work, especially after I had dumped so much test junk into it and wiped it clean so many times. I already knew that uploading files to Neocities from inside a browser works thanks to the [TiddlyWiki Neocities saver](https://alexio.neocities.org/), for which I had already set up a CORS proxy for myself on fly.io (ostensibly free for my level of usage), which meant it was just a matter of proving it out with my own project. Along the way I built the [auth](/auth) page (and spent way too long trying to perfect the BIOS-esque styling). This unlocks the ability to build truly dynamic apps for myself on Neocities, and I'm stoked to be able to use it on other projects :)