bootstrap-markdown
bootstrap-markdown copied to clipboard
Preview don't work (i include to-markdown)
Hello guys,
I do that on my header :
<script src ="js/to-markdown.js"></script> <script src ="js/bootstrap-markdown.js"></script>
I inverse the include order too, i tried a lot of thing, but the button preview still don't work...
Have an idea?
Thanks, valt
I'm having the same issue, did you manage to fix it @LeValt ?
Got it, missed the note at the bottom:
The preview functionalities and html to markdown conversion are provided by 3rd party codes : markdown-js, marked (default failover if markdown-js lib not available) and to-markdown. Without them, this plugin would still work and convert the content as-is, so you could easily modify those functionalities yourself via available hooks.
I think this needs to be made more prominent?
Hi guys,
The 3rd party library didn't work for me @LeValt and @chrise86, but I found showdown.js library to solve the problem.
Good luck!
I noticed the docs are using this fork of markdown-js.
I also ended up using showdown.js.
It was easy to setup:
<script>
var markdown = new showdown.Converter();
markdown.toHTML = function(val) {
return markdown.makeHtml(val);
}
</script>
I used marked.js. Just add it to your page and the preview button works great.
You can pass an arbitrary markdown-to-html function using the parser
option, like this:
var converter = showdown.Converter();
var convertFunction = converter.makeHtml.bind(converter);
$('textarea').markdown({
parser: convertFunction, // or whatever
});