Closed sixlettervariables closed 9 years ago
No it does not. It uses the marked function as a global variable. Thats why your workaround with window.marked is working.
I managed to get it to work with the onPreview Callback.
define(['jquery', 'marked', 'bootstrap.markdown'],
function ($, marked) {
'use strict';
$('#myinput').markdown({
onPreview: function(e) {
var previewContent = e.getContent();
if (e.isDirty()) {
previewContent = marked(previewContent);
}
return previewContent;
}
});
});
Note: marked is used solely within my requirejs define. Not in bootstrap-markdown.
Cheers,
Ro
@rommsen thanks! I ended up rolling my own instead of using bootstrap-markdown. However, your approach seems on face value to handle this just fine. I'm going to close this issue as it no longer applies in my case and your fix should work for future users.
I'm integrating RequireJS into my workflow (which seems to be a bad idea), and it appears bootstrap-markdown fails to find/work with chjj/marked:
The page itself requires everything in the right order:
Watching some custom logging I've added to RequireJS, I see that
marked
is loaded prior to bootstrap-markdown, and that it appears to call the required AMD setup as well. If I fake it out with awindow.marked = marked
call prior to using bootstrap-markdown, everything works again.Does bootstrap-markdown not use marked in an AMD friendly fashion?