refactory-id / bootstrap-markdown

Bootstrap plugin for markdown editing
Apache License 2.0
1.99k stars 371 forks source link

Preview don't work (i include to-markdown) #228

Open LeValt opened 8 years ago

LeValt commented 8 years ago

Hello guys,

I do that on my header :

`

` 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
chrise86 commented 8 years ago

I'm having the same issue, did you manage to fix it @LeValt ?

chrise86 commented 8 years ago

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?

xserrat commented 8 years ago

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!

teaqu commented 7 years ago

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>
jlthompson3259 commented 7 years ago

I used marked.js. Just add it to your page and the preview button works great.

BudgieInWA commented 7 years ago

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
});