MultiMarkdown Composer Synchronized Scrolling

Background

When working on a document, it's helpful to be able to see what the finished result will look like. When working on a long text document, MultiMarkdown Composer helps make sure that you can see the area you're working on.

Many text editors offer a live preview. That's not a big deal. But they make incorrect assumptions about the relationship between the text and the HTML preview, namely that they should scroll side by side at a 1:1 ratio. In other words, they assume that if you scroll down 25% of the way through your text, then the preview should also scroll down by 25%.

For a simplistic text document, this assumption may be close enough. But as soon as you start to work on more complex documents (e.g. images, footnotes, citations, etc.), that 1:1 relationship often breaks down. This leaves you with a mismatch between the editing you're doing and the preview.

Composer analyzes your document and creates a map that allows it to scroll much more accurately. Whatever is in the middle of the editing pane should line up with the corresponding line in the preview. It may not always be accurate to a single pixel (e.g. lines may break at different words), but it will be very close.

If you watch the video above, you'll notice that as I scroll the preview, the editor scrolls at different speeds. It speeds up and slows down so that the content stays aligned in the center. Whether that content is a single line on the left, and a full image on the right, or a paragraph of text on both.

Note

As you can imagine, it's tricky to create an accurate map for all circumstances. If you find a document that produces unusual results, please send me a copy and I'll try to improve the mapping algorithm.

Thanks!