bootstrap-markdown icon indicating copy to clipboard operation
bootstrap-markdown copied to clipboard

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

Open LeValt opened this issue 8 years ago • 6 comments

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

LeValt avatar Mar 08 '16 10:03 LeValt

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

chrise86 avatar Apr 06 '16 14:04 chrise86

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?

chrise86 avatar Apr 06 '16 15:04 chrise86

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!

xserrat avatar May 03 '16 13:05 xserrat

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>

teaqu avatar Jan 19 '17 13:01 teaqu

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

jlthompson3259 avatar Jan 25 '17 15:01 jlthompson3259

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

BudgieInWA avatar Oct 12 '17 04:10 BudgieInWA