angular-markdown-directive

AngularJS markdown directive using Showdown.js

Angular Core Dependency: ^1.0.8

Module License: MIT

Added by: Sam Deering

GitHub

Repository

btford/angular-markdown-directive

Stats

Stars: 575

Watchers: 575

Forks: 105

Author

Brian Ford
Brian Ford

Module Description

angular-markdown-directive Build Status

Bower Component for a simple AngularJS Markdown directive using Showdown. Based on this excellent tutorial by @johnlinquist.

Usage

  1. bower install angular-markdown-directive
  2. Include angular-sanitize.js. It should be located at bower_components/angular-sanitize/.
  3. Include showdown.js. It should be located at bower_components/showdown/.
  4. Include markdown.js provided by this component into your app.
  5. Add btford.markdown as a module dependency to your app.
  6. Insert the btf-markdown directive into your template:
<btf-markdown>
  #Markdown directive
  *It works!*
</btf-markdown>

You can also bind the markdown input to a scope variable:

<div btf-markdown="markdown">
</div>
<!-- Uses $scope.markdown -->

Or include a markdown file:

<div btf-markdown ng-include="'README.md'">
</div>
<!-- Uses content from README.md -->

Options

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#extensions
  markdownConverterProvider.config({
    extensions: ['twitter']
  });
}])

License

MIT

Module stats last updated: 2017-05-08 15:00:04

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!