Skip to content

Instantly share code, notes, and snippets.

@cognitom
Last active August 29, 2015 14:03
Show Gist options
  • Save cognitom/9a18797c135a1f762a6d to your computer and use it in GitHub Desktop.
Save cognitom/9a18797c135a1f762a6d to your computer and use it in GitHub Desktop.
The Simplest Markdown Directive for Angular.js
require 'angular'
require 'angular-sanitize'
angular.module 'app', ['ngSanitize']
.directive 'marked', require './marked'
<!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>
marked = require 'marked'
module.exports = ->
restrict: 'A'
link: (scope, element, attrs) ->
element.html marked element.text()

Sample Markdown

  • Angular.js
  • Browserify
  • Debowerify
  • Coffeeify
  • Marked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment