A photo of me wearing a blue blazer and pocket square while on a horse, looking quite dapper.

David Celis

A cowboy coder.

Follow me

my maddening rabbithole for the last 1-2 days has been trying to figure out why smart punctuation and text replacements work differently in various HTML inputs, contenteditable elements, and specifically CodeMirror editors depending on whether or not you’re using a Mac or an iPhone. i wish i could just let this go, but nooo, i want my own little post composer text field that makes dumb little curly quotes, fixes ellipses, and counts my characters!

Did you like this post, repost it, or respond to it? Let me know by sending a webmention!

🌐
2

💬 Replies (6)

styling the post's markdown as i type it is pretty hard to let go of too 🫠

i guess i mostly just wish i was good at frontend lol

@davidcelis this rabbit hole is deep and the solutions are not satisfying at all. its not you.

@peregrine i may or may not have written a "Markdown ReRenderer" today.

also i hate that i even had to do this. most commonmark wrappers give you an easy way to parse markdown and render it back as markdown... except they all use cmark under the hood, and cmark is extremely aggressive about what it escapes! like, "!" has no special meaning unless followed by square brackets, but it'll still escape every single bang on its way back to markdown. maddening!

@davidcelis surprisingly I did something like this recently. Markdown isnt ideal.

@davidcelis i used the elixir earmark package which gives you the ast and I fixed the .html.md.erb that way. I even grabbed the ruby partials and embedded them. Ended up not using it totally and they have spent weeks just getting to where I got doing it the “right” way.