Pure Client-Sided Markitup

141 Views Asked by At

As my understanding, Markitup needs server side to do parsing. Is there any pure client-sided Markitup?

1

There are 1 best solutions below

0
On

You could implement the parsing using javascript so that you don't need any server side logic.

When you download MarkItUp the example is using javascript to generate the preview

$.ajax({
    url:options.previewTemplatePath,
    dataType: 'text',
    global: false,
    success: function(data) {
    writeInPreview( localize(data, 1).replace(/<!-- content -->/g, $$.val()) );
    }
});

function writeInPreview(data) {
            if (options.previewInElement) {
                $(options.previewInElement).html(data);
            } else if (previewWindow && previewWindow.document) {           
                try {
                    sp = previewWindow.document.documentElement.scrollTop
                } catch(e) {
                    sp = 0;
                }   
                previewWindow.document.open();
                previewWindow.document.write(data);
                previewWindow.document.close();
                previewWindow.document.documentElement.scrollTop = sp;
            }
        }

So you can just add your parsing logic in writeInPreview for example.