Bower Component for a simple AngularJS Markdown directive using Showdown. Based on this excellent tutorial by @johnlinquist.
bower install angular-markdown-directive- Include
angular-sanitize.js. It should be located atbower_components/angular-sanitize/. - Include
showdown.js. It should be located atbower_components/showdown/. - Include
markdown.jsprovided by this component into your app. - Add
btford.markdownas a module dependency to your app. - Insert the
btf-markdowndirective into your template:
<btf-markdown>#Markdown directive *It works!*</btf-markdown>You can also bind the markdown input to a scope variable:
<divbtf-markdown="markdown"></div><!-- Uses $scope.markdown -->Or include a markdown file:
<divbtf-markdownng-include="'README.md'"></div><!-- Uses content from README.md -->You can configure the markdownConverterProvider:
angular.module('myApp',['ngSanitize','btford.markdown']).config(['markdownConverterProvider',function(markdownConverterProvider){// options to be passed to Showdown// see: https://github.com/coreyti/showdown#extensionsmarkdownConverterProvider.config({extensions: ['twitter']});}])MIT
