I'm using markdown editor in my app.
$(document).ready(function () {
var converter = Markdown.getSanitizingConverter();
var editor = new Markdown.Editor(converter);
editor.run();
});
<div class="wmd-panel">
<div id="wmd-button-bar"></div>
<textarea class="wmd-input" id="wmd-input" rows="7" cols="30"></textarea>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview" name="Content"></div>
Initially, the textarea field is empty. After I enter some text, everything works as expected:
Firebug shows such html structure:
Now I need to get entered pure markdown text: **where** is it ?
. I need it because I think it should be stored in the database (and later retrieved from database and converted to html when showed to the user). I have no idea how can it be reached. How can I get it ?
They've have some Docs which might be helpful to you.
The fancy way would probably be to catch the preConversion
event in the event-chain:
converter.hooks.chain('preConversion', function(markdown) {
// Do something wonderful with you markdown variable, and then return it.
return markdown;
});
The less fancy way, but working as expected would be to just retrieve the value of the value parameter of the textarea.
var textarea = document.getElemetById('wmd-input');
var markdown = textarea.value;