Krajee

Basic Usage Example 3

Thankful to Krajee! BUY A COFFEEor to get more out of us.

Initialize the plugin entirely via javascript. This is a variation to Basic Example 1, where the CSS class markdown is NOT ADDED to the textarea element. The plugin options are instead set via javascript as options to the plugin markdownEditor.

This example also shows usage of other plugin options. For example, you can open the widget by default in SPLIT mode (markdown editor and HTML preview side by side), by setting the defaultMode to split. Notice how the widget provides synchronized scrolling of the raw text and formatted HTML content. Note that the SPLIT mode does the markdown conversion on the FLY as you type/edit, and can have a performance impact in updating the preview. If you do not wish the preview to be updated on the FLY - then set enableLivePreview to false.

Note, the demo example(s) uses:

  • this as the raw input source for the markdown textarea.

  • these assets loaded on the page in the order mentioned.

Tip

Not seeing the updated content on this page! Hard refresh your browser to clean cache for this page (e.g. SHIFT-F5 on Windows Chrome)


Example
Code
<textarea id="editor-b3" name="editor-b3" class="form-control" rows="15">
{RAW MARKDOWN DATA}
</textarea>

<script type="text/javascript">
$('#editor-b3').markdownEditor({
    bsVersion: '4.1.1',
    defaultMode: 'split'
});
</script>

Note

You can now visit the Krajee Webtips Q & A forum for searching OR asking questions OR helping programmers with answers on these extensions and plugins. For asking a question click here. Select the appropriate question category (i.e. Krajee Plugins) and choose this current page plugin in the question related to field.

The comments and discussion section below are intended for generic discussions or feedback for this plugin. Developers may not be able to search or lookup here specific questions or tips on usage for this plugin.

 
visitors to Krajee Jquery Plugins since 22-May-2017