Apostrophes and colouring

jonathan's Avatar


03 Feb, 2018 11:55 AM

I'm confused by some behaviour which seems out of line with the settings. I have left the smart pairs list as the default, which doesn't include single apostrophes (not back ticks). But when I write text anything I 'quote' is shown in the 'pairs' colour in the theme file. It's not a major issue. But it is more annoying on text that includes several possessive plurals that end s-apostrophe. E.g. "After Jess' boss did something real bad, her boss' ass got kicked." (OK, very silly example.) This also gets coloured from the 1st to 2nd apostrophe inclusive. For now I've turned off the colouring, having found the 'quoteSingle' keyword.

(Edit: don't know why this got marked private. I can't seem to unmark it.)

  1. Support Staff 1 Posted by Fletcher on 03 Feb, 2018 12:53 PM

    Fletcher's Avatar

    You're actually talking about several different things.

    "Smart Pairs" refers to the ability to have Composer automatically "close" the syntax when you type an opening character. When you type (, Composer also inserts the ) and puts the cursor in between the two. Smart Pairs are not part of MultiMarkdown, since they are only a concept that is useful while typing, not when processing an existing document.

    "Smart Quotes" refers to a feature in MMD itself that substitutes "typographically correct" quotes for plain quotes, such as converting "foo" to “foo”. (You might have to copy the text and change to a larger font size to see the difference between those examples.)

    Because smart quotes require an understanding of which characters open and close pairs, MMD has to pair them off. The same algorithm is used for pairing all characters, whether it is for smart quotes (e.g. "foo") or for other structures (e.g. [foo]).

    Because Composer themes use a hierarchical approach, there is the concept of "pairs", of which other forms of markup are descendants (e.g. "angles", "brackets", etc.) So depending on your chosen theme, the markup may be applied to the general category (pairs) or to specific instances (brackets). Solarized, for example, disables pairs by changing it to pairsz, but applies specific colors to angles, brackets, etc. The Default theme, however, just uses the general pairs category.

    Finally, the example you give doesn't seem to fit any of these (if we ignore the outer double quotes. If I copy/paste your example, or if I type something similar myself, the possessive apostrophes do not trigger pairing, because they are incompatible to form pairs. You would need to also have a word that start with an apostrophe to trigger pairing. Can you verify the example you sent?

    To summarize:

    1. Smart Pairs affect typing only, not syntax highlighting or HTML output.

    2. Smart Quotes affect output (e.g. HTML, LaTeX, etc.), but not typing or syntax highlighting.

    3. Syntax highlighting can be controlled however you like by customizing themes -- take a look at the examples and you can pick and choose whatever behavior you like.

    4. I can't make your example fit into any of these categories, so maybe I am doing something wrong. Let me know.

    Hope this helps!


    PS> I converted this thread to public. Let me know if I should change it back.

  2. 2 Posted by jonathan on 03 Feb, 2018 02:33 PM

    jonathan's Avatar

    Many thanks, @Fletcher. I'd figured out the hierarchical nature of the pairs from the Theme dox. Annoyingly, I've edited the actual example text I had earlier, so can't send that. I thought it was "Praying in Jesus' name, then, means … yadda yadda ... in Jesus' name." (without double quotes). But that works fine. So sorry for what's probably a false report, particularly if your test for them only works at the start of a word.

    I've tweaked the theme to make all the pairs colouring much more subtle. I'll report again if I find another example of what I thought was going on.

  3. Fletcher closed this discussion on 04 Feb, 2018 06:38 PM.

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

Keyboard shortcuts


? 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