Code block

Vince's Avatar


18 Aug, 2017 04:13 PM

Inside a code block (four spaces at beginning of line) should allow further indentation, etc. with spaces. However, preview isn't showing it (I have "Update preview whenever text changes" checked, but I've also command-R'd to force a refresh).

IOW, with this code block:
    this is a code line
      this is another code line, indented two spaces
    this is another code line

Preview is showing it as:
this is a code line
this is another code line, indented two spaces
this is another code line

The second line should be indented.

Is there a syntax document somewhere for MMD? There's not one in Help, I searched "syntax" on the page that Help/MultiMarkdown Composer Help takes you to, and there was nothing there, and I then did a web search for "MultiMarkdown syntax" and the only thing I saw that was relevant was a github page last updated in 2014 that didn't have most of the syntax on it.

This is something that should be in Help.

  1. Support Staff 1 Posted by Fletcher on 18 Aug, 2017 04:30 PM

    Fletcher's Avatar

    Remember -- this is a beta. The "polish" stuff like a syntax guide
    (which doesn't exist in a concise form for MMD-6 yet) is not there.

    Shortest MMD 6 documentation is here:


    As for the preview -- it works fine for me. Everything is indented
    based on number of spaces. Can you send me the exact file you're
    trying? Your example below is fine.

    (As an aside -- there is a bug in Apple's Webview. Short version -- if
    all you do is add a space character, it causes a strange refresh to
    happen. So Composer doesn't refresh the preview if all you do is type a
    space character. Type another letter and then delete it to make sure it
    refreshes. This bug has been there for many years, and shows no signs
    of being fixed. Interestingly it doesn't exist on the iOS version.)

  2. 2 Posted by Vince Rice on 18 Aug, 2017 07:25 PM

    Vince Rice's Avatar

    Yes, I remember this is a beta. But I also remember this is a five-year old program according to one of your other posts. :) I would therefore have expected this to already be there, even if it wasn't updated for v4. I'm not looking for new things, I'm looking for very old things.

    Thanks for the link, that's somewhat helpful, but still not really what I'm looking for. My other MD editors have a help page that shows example code on the left and a preview on the right, so we can see the complete syntax that is supported by the program. For example, MMD apparently doesn't support #Header type headers, just underscore headers. Which is fine (I don't care it doesn't support # ones, and I don't care whether that's "official" MD or not), but that's useful information to know. Likewise, having an example of regular and inline footnotes. And I don't use tables enough that I never remember the syntax. And so forth.

    This is a short sample document that illustrates the problem, at least on my system. Adding leading spaces (I tried one, two, and three) on any of the three code block lines does not update the preview, even when command-R is pressed. If I have to add and delete a character just to get the preview updated … well, that's not going to work. I'm usually pasting in what's in a code block. Pretty much all a code block is going to contain is leading spaces. (Well, I guess it contain leading tabs, but not in my case, and that's an entirely different argument. :) ) And, Apple bug or not, MMD is the only one of the four MD editors I have that exhibit this behavior. That, to me, makes it an MMD problem.

  3. Support Staff 3 Posted by Fletcher on 18 Aug, 2017 08:35 PM

    Fletcher's Avatar

    1) Old app, but new build (completely from scratch). So "less
    important/urgent" things aren't there yet. This isn't just a version bump.

    This is probably what you saw, but just in case. It's accurate for
    older versions of MMD, and mostly accurate for version 6.


    2) MMD supports "# Header" headers, but that space between is required.

    3) The example you sent has 3 lines in a code block, all of which are
    indented by precisely 4 spaces. Therefore they should line up.

    4) You misunderstand the issue with spacing. The preview is not
    visually refreshed when you *type* a space. Type any other key, and the
    entire preview is refreshed. Including any changes to any spaces
    anywhere in the document made previously. If you paste a code block,
    all spaces are properly previewed. The changes are there, you just
    can't see them until you type something besides the space key.

    (Trust me -- the space/Webview thing is very strange, I have looked it
    into it off and on for years. Most webviews aren't designed to be as
    responsive as mine, and it only causes issues in particular
    circumstances that most of the probably don't use. If you want a full
    treatise on it, I'm happy to oblige. But I suspect you really don't...
    ;) Short version -- The web preview in Composer is better than any
    other that I have seen in many ways (for a live text editor -- it has a
    different purpose than something like Marked). One limitation is having
    to be very careful when inserting spaces.

    And it really is just spaces -- tabs are fine.

    The next beta will have one tweak related to this -- when you manually
    refresh the preview it overrides the fact that the last key typed may
    have been a space. So you won't have to type anything to trigger an
    update, just manually refresh.

    Alternatively, you can set the preview to update only when the file is
    saved. Then the space typing issue is circumvented entirely

  4. 4 Posted by Vince Rice on 18 Aug, 2017 09:53 PM

    Vince Rice's Avatar

    1. Yes, the app is completely different, but the markdown syntax you're supporting changed isn't that different. And, as I said, even if it is, I'm not looking at the differences, I'm looking at things you've been supporting forever.

    And no, actually, that link is not what I saw, but it is exactly what I was looking for — thank you! I personally would love to see that as an imbedded help page in the app. But if not, at least a help menu item to go there. Even now, even if that isn't completely current. That's far too handy to have to remember.

    2. Perfect example of why the guide is needed. :)

    3. I sent an example of a file that, when I add spaces to the front of any of those three lines, you can't see them in the preview. I know that when you open a doc the preview works. :)

    4. Yes, the send/receive on that was not clear; you said "add a non-space" but it was in the context of adding spaces, so that's what I thought you meant. Typing a non-space anywhere is definitely not as bad. With that and the fix to refresh Preview, and the fact that code blocks are used fairly rarely in general (but unfortunately quite often in what I'm working on right now), it's eminently livable. (But it's still a problem only your app has, and I don't have "responsiveness" problems with them. I have plenty of other issues, but not that.)

    Since we only report problems here, I feel like I should note that, overall, I like the program so far; I'm using it for real work, so it's a great way to get to know it. As just one example, I like the fact that Smart Pairs are definable; it took several occurrences to figure out why I was getting an extra underscore every so often (I'm typing a lot of code names that have underscores in them) and it was nice to be able to fix that (I've always used asterisks for italics so I don't need the underscores).

  5. Support Staff 5 Posted by Fletcher on 19 Aug, 2017 12:47 AM

    Fletcher's Avatar

    1. Imagine building a car in your garage -- the last things you're going
    to do are put on the stickers telling you that objects in mirrors are
    closer than they appear. (BTW -- that page is in previous versions of
    Composer, and one like it will be in v4)

    4. Since you're so fixated on the preview and spaces, I'll tell you
    more. Just remember -- you (implicitly) asked for it.... ;)

    (But before that, thank you for the positive comments. I have a lot of
    users who swear by Composer, and I'm proud of it. Hopefully v4 will
    continue that tradition.)

    Most previews that I have seen are very basic. Add some CSS and a few
    other things and call it a day. Maybe you even provide "synchronized
    scrolling" by saying that if the text editor is at 70% from the top,
    then the web view should be at 70% from the top. As you can imagine,
    that is horribly inaccurate.

    Composer's preview is a lot more advanced:

    1. When you type, the line you are typing on in the editor lines up with
    the same line of text in the web view. (It's not 100% accurate in all
    circumstances, but it's very accurate most of the time.) You don't have
    to scroll up and down to find the area of interest -- it's just right
    there, lined up with your typing. It even works with inline footnotes,
    which I happen to think is *really* friggin' cool.

    2. With synchronized scrolling, the text on the left lines up with the
    same area on the right. Even when you have something like an image that
    takes up a single line of source, but an entire screen of the preview.
    Again, not 100% perfect all of the time, but remarkably accurate
    overall. In fact, I can sometimes just watch the two scroll up and down
    at different speeds for a bit -- sort of mesmerizing.

    3. I've worked hard to optimize performance to provide fast refresh
    speeds. (NOTE: I noticed in experimenting while writing this that v4
    b15 slowed down at large window sizes. Found the problem, and things
    are back to really fast -- b16 will have these fixes.) It keeps up with
    my average typing letter for letter. If I rapidly type gibberish as
    fast as I can it updates several times per "word". All while keeping
    everything lined up nice and pretty... ;)

    4. More importantly, it does this without slowing down the
    responsiveness to your typing, even when pounding on the keyboard like a
    monkey on crack.

    5. I'll trade all this for not seeing a refresh every time I hit the
    spacebar.... ;) Specifically, the problem that causes is that when you
    type a space, the preview jumps to the top and then rapidly scrolls back
    to the proper position. Other letters are fine, but inserting a single
    space causes something weird to occur in Apple's WebView. I've been
    dealing with this for years, unfortunately, and finally gave up. If I
    remember correctly, I even submitted a bug report to Apple. No word on
    that one, of course.... ;)

    I'm not aware of any other apps that have managed to copy me on this
    stuff yet.... (As an aside, a couple of months ago I was browsing the
    App Store and discovered that a bunch of apps have even copied the style
    of my app description.... Craziness!)

    Hope that helps, and probably provided more information than you care
    about. But it did lead to me fixing that performance issue, so win/win!


  6. Support Staff 6 Posted by Fletcher on 19 Aug, 2017 05:02 PM

    Fletcher's Avatar

    I finally figured out a more efficient way to create a syntax guide while actually being able to use MMD to write most of it (the old one was rather tedious to maintain).

    Direct link:

    Github repo:

  7. Fletcher closed this discussion on 19 Aug, 2017 05:02 PM.

  8. Vince Rice re-opened this discussion on 19 Aug, 2017 06:20 PM

  9. 7 Posted by Vince Rice on 19 Aug, 2017 06:20 PM

    Vince Rice's Avatar

    OK, I don’t want to belabor this because you’ve been very helpful and the link to the syntax guide was exactly what I was looking for (and the new one looks great). To clarify:

    I understand the beta process. I’ve been beta testing things on Windows/handhelds/Mac for a very long time. But all of those menus in MMD didn’t suddenly show up in the v4 beta. For the most part, they’ve been there all along (again, I point to your “its the same as it's been for the five years of MMD’s existence” remark). And that was my (only) point — that a link to the syntax guide should always have been in the Help menu. It shouldn’t need to be added as the last step in the car-building process. The last step in the car-building process would be to update the syntax guide for whatever changes were made for v4.

    But, let’s stop beating this poor horse. That syntax guide is awesome, exactly what I was looking for, and I’ll both spend some time familiarizing myself with it and bookmark it for future use. And I along with everyone else look forward to seeing what the finished car looks like. :)

    I was about to go play with some CSS for the preview pane, but in light of your preview remarks below, I'm going to open a new discussion, because I'm not seeing what you're describing.

  10. Fletcher closed this discussion on 19 Aug, 2017 06:24 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