(that you can't see, sorry)
I spent a couple days adding some cool interactive stuff to my blog.
I'm only running the backends locally, so you'll have to trust me! it's really cool!!
>> Commits <<
1
the first one is a post editor, which lets me
- preview markdown into an iframe, going through my exact blog build
- fetch/post posts (very unsecure haha)
I added a user script to link both remote and local pages to the corresponding edit page, so it's super low friction to edit posts and start new ones, without leaving my browser. A really cool feature would be to parse the markdown and treat each section as its own editable region... maybe it's possible with pandoc, I'm not really sure.
2
the second feature (which may be public at some point, but again security and computational power … gosh I want my own server …), is a page for writing parser combinators in PureScript
what it does:
- it parses a PureScript expression that you write
- it compiles it into a Proper PureScript File, by adding a fuckton of imports and two top level declarations
- this itself requires a pre-build step, where I parse my template file ahead of time, and store it as a data structure in a different file
- this required being able to output PureScript source code for the corresponding data types
- yeah it was very extra to go that route instead of just embedding a string :P
- sends it to a TryPureScript backend to compile the parser
- throws it into a UI at the end, where you can see its BNF grammar and run it against inputs
- this requires a little delicacy because, even though it's PureScript<->PureScript, it is basically an FFI boundary because two instances of PureScript do not have compatible datatypes, so everything needs to be strings and functions and records instead
definitely needs a little more polish on the UI end, but the great news is that I will be able to adapt some of my existing LR(1) parser visualizations for the new types
(see https://cofree.coffee/~verity/parser.html)
I was able to integrate this all with my existing build systems, so it all gets built correctly when I edit the PureScript source
and I had fun spending a day cleaning up my code to make it all work nicer
anyways, I am so so happy to have a website that works for me, my own little corner of awesomeness that is getting lower friction as I put more time into it
and a big shoutout to natefaubion for creating the PureScript parsing/printing tools I used for the task :)
check out his great work: purescript-language-cst-parser & purescript-tidy-codegen
3 (bonus)
oh I almost forgot: using those tools, I added “proper” syntax highlighting for PureScript in pandoc … but there's a lot more I want to do there still
(it just tokenizes and spits it out with class names, nothing fancy)
