- Angular.js
- Browserify
- Debowerify
- Coffeeify
- Marked
Last active
August 29, 2015 14:03
-
-
Save cognitom/9a18797c135a1f762a6d to your computer and use it in GitHub Desktop.
The Simplest Markdown Directive for Angular.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'angular' | |
require 'angular-sanitize' | |
angular.module 'app', ['ngSanitize'] | |
.directive 'marked', require './marked' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app="app"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Markdown</title> | |
</head> | |
<body> | |
<section marked ng-include="'sample.md'"></section> | |
<script src="index.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
marked = require 'marked' | |
module.exports = -> | |
restrict: 'A' | |
link: (scope, element, attrs) -> | |
element.html marked element.text() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment