AngularJS Markdown using marked.
Please note: neither this directive nor marked (by default) implement sanitization. As always, sanitizing is necessary for user-generated content.
bower install angular-marked
npm install angular-marked
jspm install angular-marked=npm:angular-marked
Depending on your setup you may need include script tags in your html:
var app = angular;
Set default options (optional)
Override Rendered Markdown Links
Example overriding the way custom markdown links are displayed to open in new windows:
Use as a directive
# Markdown directive*It works!*
Bind the markdown input to a scope variable:
<!-- Uses $scope.my_markdown -->
Include a markdown file:
<!-- Uses markdown content from README.md -->
Or a template (great for md that includes code blocks):
<!-- Uses markdown content from tpl.md -->
compile attribute to support AngularJS directives inside markdown.
As a service
Install npm and bower dependencies:
npm installbower installnpm test
I wanted to use
marked instead of
showdown as used in
angular-markdown-directive as well as expose the option to globally set defaults. Yes, it is probably best to avoid creating a bunch of angular wrapper modules... but I use this enough across multiple projects to make it worth while for me. Use it if you like. Pull requests are welcome.
Copyright (c) 2013-2015 Jayson Harshbarger