Smarter quotes

Vince's Avatar

Vince

21 Oct, 2017 08:38 PM

I realize the narrowness of this issue, just throwing it out there.

When quoting within quotes, it's common to put a thin space in between the quotes to make the output more readable. IOW, instead of “‘, a thin-space (U+2009) is inserted between the two to make them easier to differentiate (it's almost impossible to tell whether it's single-double or double-single without the thin space).

However, putting the thin space in-between triggers MMD's smart quote algorithm, which turns the single opening quote into a single closing quote. So instead of getting “ ‘ we get “ ’ (imagine that space is a thin space).

I'm not sure why it's doing that (since there was no opening single quote, there's no reason to change it to a closing one), but whatever the reason, it would be nice if it was smart enough not to do that if the only thing between the quotes was a kind of space (a real one, a thin one, a non-breaking one, etc).

The reason I bring it up is because there's no recourse — MMD does the wrong thing, and there's no way to fix the source document to keep it from doing so (that I've found), and thus the only alternative is to hand-edit the output, which obviously isn't workable at scale.

Thanks!

  1. Support Staff 1 Posted by Fletcher on 21 Oct, 2017 11:45 PM

    Fletcher's Avatar

    MMD is doing the right thing. It's just not what you want.

    As far as MMD is concerned, the only whitespace characters are space and
    tab (line endings are different). So anything else would be non-space,
    which could be replaced with letters.

    Imagine using an `x` instead of the thin space character.

    "x'foo'x"

    Or, to expand to a slightly more realistic example:

    "dave's uncle's"

    In this case, you have double quotes wrapped around text that happens to
    have two apostrophes inside of it. That's what MMD is doing with your
    thin space example.

    Conversely, if MMD *did* treat thin space as whitespace, you would have
    the equivalent of:

    " 'foo' "

    In this case the single quotes pair, but the outer double quotes do not
    since they have whitespace (or line endings) on either side.

    So one solution is, of course, the obvious one -- use actual "curly"
    characters in your source. You can do whatever you want using whatever
    rules you like and MMD will not change them

    Or create an automatic expansion to convert `"'` into `“ ‘` and `'"`
    into the opposite.

    Or create a script to insert thin spaces between consecutive curly
    quotes in the output, which does work at scale. No reason to do it by hand.

    F-

  2. 2 Posted by Vince Rice on 23 Oct, 2017 02:55 PM

    Vince Rice's Avatar

    > As far as MMD is concerned, the only whitespace characters are space and
    > tab
    >

    Yes, and this is the problem, and the reason I posted in the first place. Thin spaces and non-breaking spaces and zero-width spaces are all a type of space. I don't need to imagine an 'X', because an X is a letter and these aren't. The comparison is invalid.

  3. Fletcher closed this discussion on 28 Oct, 2017 05:33 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