CommonMark rendering in angularjs (A strongly specified, highly compatible implementation of Markdown).
===
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.
bower install Hypercubed/angular-commonmark
commonmarkjs
script into your app. By default should be at bower_components/commonmark/dist/commonmark.js
.angular-CommonMark.js
into your app. By default should be at bower_components/angular-commonmark/angular-commonmark.js
.hc.commonmark
as a module dependency to your app. <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 -->
app.controller('myCtrl', ['CommonMark', function(CommonMark) {
$scope.html = CommonMark('#TEST');
}]);
Install npm and bower dependencies:
npm install
bower install
npm test
Based on
Using
Copyright (c) 2014 Jayson Harshbarger