Closed Thasthagir closed 9 years ago
I actually have the same problem and I'm trying to integrate this with angular as a directive. The markup I have is:
<textarea markdown-editor name="" id="" cols="30" rows="10"></textarea>
and I have some code that looks like this:
ngModule.directive('markdownEditor', ['CssLoader', function(CssLoader) {
CssLoader.load('BASE_URL/core/styles/bootstrap-markdown.min.css');
return {
scope: {
},
link: function(scope, elem, attrs) {
$(elem).markdown({
savable:true,
});
}
};
}]);
Basically this:
$(elem).markdown({
savable:true,
});
Which renders:
But when I hit the preview button, I get:
Any idea why this may be happening? Am I missing a step?
I figured out my problem at least. The library requires the markdown-js library to be included before this one in order for parseContent()
to render the content to html. No mention in the docs (unless I'm blind).
@admosity There is actually a "NOTE" section in the very bottom of the doc.
Anyhow, i'll close this issue until there is more info.
Ah yeah, missed that one. I think it should be more clearly stated/visible in the docs since most people will attempt dropping in the demo code on the page and just expect it to work. Something like... The following demos have markdown-js included for rendering.
Ah yeah, missed that one. I think it should be more clearly stated/visible in the docs since most people will attempt dropping in the demo code on the page and just expect it to work.
Then those people should just use CKEditor or other plug-and-play - but mostly bloated - plugin. I intentionally put it on the bottom, so user can first get a sense of the flexibility of this plugin via available hooks and methods. Even if they doesn't include markdown-js
, this plugin would still behave as it should (in terms of changing and triggering state properly)
Thats the rationale, if you want full disclosure :)
I completely agree with you on the bloated part and I'm not saying to directly include the library within the code. I myself am using a requirejs/bower setup, so it's perfect for me. I'm just saying the way the demos were advertised without a clear (visible) disclaimer makes it seem that the markdown to html preview was out of the box functionality. I doubt many users (like myself) would make it to the note at the bottom before cherry picking a nice demo off the page and then scratch their heads when it's not rendering the preview.
Nevertheless, wonderful plugin!
Not to beat a dead horse, but I agree with @admosity that keeping that note at the bottom of the doc will certainly lead to some confusion in the majority of use cases. It's an awesome plugin and I would hate to see users dismiss it because they don't know enough to search through the issues or just never make it to the bottom of the docs.
@Thasthagir Could you elaborate? Some use case maybe. Or some jsfiddle.