tylingsoft / markdown-plus

Markdown editor with extra features.
http://mdp.tylingsoft.com/
2.12k stars 391 forks source link

How might I run MDP in "preview only" mode? #79

Closed robert-stuttaford closed 7 years ago

robert-stuttaford commented 7 years ago

I have integrated MDP into a web-based CMS (to be open-sourced soon).

Part of its feature-set is that it allows the developer to control whether users can read and edit, or just read. Now I'd like to have MDP do just the Preview part, and not any of the Edit stuff.

Is it possible to do this with the current minified distribution, or do I need to patch together my own variant of markdown-plus.js + dependencies?

Thank you for a wonderful editor, Tyler!

robert-stuttaford commented 7 years ago

For now I have done this:

$(function() {
    setTimeout(function() {
        layout.sizePane('east', '100%');
        $('.ui-draggable-handle').remove();
    }, 1000);
});

But of course that presents the user with the editor for a couple seconds, which is not ideal.

tylerlong commented 7 years ago

Sorry for the late reply. I am currently busy learning React, Redux and webpack and I am planning to make MDP more modern. :)

If you want preview only, you don't even need toolbar. Do you?

Check this project instead: https://github.com/tylingsoft/markdown-core

Sample code:

var mdc = require('markdown-core/markdown-core-node');
var markdown = '# your markdown here';
var html = mdc.render(markdown);
$('.markdown-body').html(html);

With the code above, you can implement a markdown preview yourself without MDP. https://github.com/tylingsoft/markdown-core also provides CSS.