Bold/italic or vice-versa

Vince's Avatar

Vince

21 Oct, 2017 09:54 PM

I want something in bold italic. I type Cmd-I to get italic, which puts the | in the document (where | is the cursor). I then type Cmd-B to get bold. Instead of getting two more asterisks on either side of the two existing asterisks, the two existing asterisks disappear. The same thing happens in reverse — typing Cmd-B gets |, but then Cmd-I results in just |. So, not only are they both wrong, but they have different results; in the former, you're left with neither of the two, in the latter, you're left with only the second of the two.

If you have text highlighted, they both do the right thing. We shouldn't have to type the text first; having something bolded and italicized is not an uncommon occurrence, we should be able to type it "naturally."

  1. Support Staff 1 Posted by Fletcher on 22 Oct, 2017 12:31 AM

    Fletcher's Avatar

    The difficulty here is that unlike a word processor, MMD uses a single
    token (`*`) to mean multiple things:

    * A list marker
    * The start of italics
    * The end of italics
    * The start of bold (if there are two of them)
    * The end of bold (ditto)

    Determining the user's intent can be tricky, since there may be more
    than one way to interpret what's going on in a document that is by
    definition unfinished. (A proper algorithm even in a finished document
    is extremely difficult. Neither the one used by MMD nor the one used by
    commonmark are perfect -- each has edge cases that seem obvious to a
    human but fail.) This is even more true in MMD-6, where one can have
    bold nested inside bold, for example.

    I'm happy to consider updates to the algorithm, but I suspect no
    algorithm is going to fit every conceivable scenario. (v2 used a
    different algorithm that fits your situation better, but has other
    problems.)

    As for the specific scenario you describe, you can simply type three
    asterisks to indicate bold and italics. No need to type your text, then
    select it, and then Cmd-B, Cmd-I.

  2. 2 Posted by Vince Rice on 23 Oct, 2017 03:28 PM

    Vince Rice's Avatar

    Thanks for the list, but I'm well aware of what asterisks are used for. :) I'm also aware there is no ambiguity to my scenarios.

    You don't have to determine the user's intent. You have to do the expected thing. Where they match, great. Where they don't match, the expected thing is still the right thing.
    The expected thing when typing Cmd-I (when nothing is highlighted) is to add an asterisk on either side of the cursor. The only scenario where that isn't what's expected is when what surrounds the cursor is one asterisk on either side of the cursor that isn't two asterisks on either side — that removes the single asterisks. That's it. Any other time Cmd-I is typed when nothing is highlighted, we should get the asterisks. Period. There's no "intent" involved.

    Ditto for bold.

  3. Support Staff 3 Posted by Fletcher on 28 Oct, 2017 05:31 PM

    Fletcher's Avatar

    Next version will have updates to the Bold/Italics algorithm

  4. Fletcher closed this discussion on 28 Oct, 2017 05:31 PM.

  5. Vince Rice re-opened this discussion on 28 Oct, 2017 05:49 PM

  6. 4 Posted by Vince Rice on 28 Oct, 2017 05:49 PM

    Vince Rice's Avatar

    Cool, thanks!

  7. Fletcher closed this discussion on 28 Oct, 2017 06:14 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac