An Angular directive for including external markdown files

This angular directive includes external markdown files, compiling them to HTML at runtime using marked.js.

I coded this as part of my notCMS.js project - which aims to offer basic content editing functionality via external markdown files to statically hosted (GitHub, DropBpox) websites.

<!DOCTYPE html>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>An Angular directive for including external markdown files</title>
    <script src="//"></script>
    <script src="//"></script>

    <script type='text/javascript'>

        var app = angular.module('myApp', []);

        app.directive('markdown', ['$compile', '$http', '$templateCache',
            function($compile, $http, $templateCache) {
                return {
                    restrict: 'AE',
                    replace: true,
                    transclude: false,
                    compile: function(elem, attr) {
                        templateLoader = $http.get(attr.src, {
                            cache: $templateCache
                        .success(function(md) {
                        .error(function(md) {
                            errStr = 'An error occurred processing markdown file <a target="_blank" href="' + attr.src + '">' + attr.src + '</a>: ' + md;



<body ng-app="myApp">
    <markdown src="">This content will be replaced my markdown</markdown>
    <p markdown src="" />

    <div markdown src="" />


Demo here -

Soucrecocde here -