Hey René, writing to you in English because I’ll publish this in my work log.

I’ve been meaning to add some simple formatting shortcuts to Blank Page (mainly Bold ⌘B and Italic ⌘I), but I’ve avoided it because doing it correctly is a bit tricky. Here’s an example:

I select this line and press ⌘B
Let's say I want to make this **bold**

This is the naive way:
**Let's say I want to make this **bold****

This is the desired way:
**Let's say I want to make this bold**

LIke this, there are a couple of edge cases that I can think about right off the bat (what if there is no text selected? What if you want both bold and italic? What if I have to contiguous blocks of bold?) and surely many others that escape my awareness at the moment.

Doing this right would be quite time consuming. My question for you is this: what would be better at this stage? a naive implementation that does just the bare minimum? (adding and removing the formatting characters), or should we only implement this when we can afford the time to do it correctly?

I’ve taken a look at how other editors do it. Unfortunately, open source js implementations take the naive route, so I can’t adopt their implementation. IA writer does a good job at it, but even then, I came across some edge cases where it did undesired things, so it’s surely not an easy problem to resolve.

What is your take?

Cheers,


My general take is that we could give the naive way a try and take it from there. Worst case scenario, we roll it back. This was one of the top feature requests during the fundraising campaign, so I like the idea of supporting (a little bit) more formatting options.

Looking at your example, I’m a bit puzzled why the first one already has the asterisk symbols in bold (bold). Assuming you added them manually before the ⌘B shortcut, the second example (naive way) doesn’t seem too bad.

My preferred implementation would be like Ulysses, which is similar to iA Writer, but uses underscore for italics, instead of single asterisk, and then double asterisk for bold, which is confusing.

Ulysses

Hope this helps!

René Galindo