markdownmarkitup

MarkItUp! continuous preview refresh without hitting enter


I'm using MarkItUp (http://markitup.jaysalvat.com/) and can't really figure out how to get it to continuously update the preview pane as each character is typed (or even when a 'space' is encountered). By default it refreshes the preview pane only when the enter key is hit.

Is there any way to customize this behavior? The documentation mentions a previewAutoRefresh key, but setting it results in the update-on-enter thing, not any faster.

Thanks!


Solution

  • Use the same technique as in this question.

    $(".mymarkitupclass").keyup(function(){
        $('a[title="Preview"]').trigger('mousedown');
    });

    Note that this will send a new request to your webserver on every keypress, so if you have a lot of users, this'll be a lot of hits.