/angular-commonmark

CommonMark rendering in angularjs (A strongly specified, highly compatible implementation of Markdown).

Primary LanguageJavaScript

angular-CommonMark Bower version

===

Render markdown in AngularJS using CommonMark; A strongly specified, highly compatible implementation of Markdown.

Please note: neither this directive nor the CommonMark implementation does any type of sanitization. As always, sanitizing is necessary for user-generated content.

get this with bower

Usage

  1. bower install Hypercubed/angular-commonmark
  2. Include the commonmarkjs script into your app. By default should be at bower_components/commonmark/dist/commonmark.js.
  3. Include the angular-CommonMark.js into your app. By default should be at bower_components/angular-commonmark/angular-commonmark.js.
  4. Add hc.commonmark as a module dependency to your app.

As a directive

	<common-mark>
	     #Markdown directive
	     *It works!*  
	</common-mark>

Bind the markdown input to a scope variable:

	<div common-mark="my_markdown">
	</div>
	<!-- Uses $scope.my_markdown -->

Include a markdown file:

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

As a service

	app.controller('myCtrl', ['CommonMark', function(CommonMark) {
	  $scope.html = CommonMark('#TEST');
	}]);

Testing

Install npm and bower dependencies:

	npm install
	bower install
	npm test

Acknowledgments

Based on

Using

License

Copyright (c) 2014 Jayson Harshbarger Gittip donate button Paypal donate button

MIT License