Angular: Empty Fiddle

http://angularjs.org/

by IgorMinar

HTML

<script src="http://code.angularjs.org/angular-1.0.0rc6.js"></script>
<script src="https://raw.github.com/coreyti/showdown/master/src/showdown.js"></script>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
    <h1>Mardown Demo</h1>
    
    <markdown>
## Heading

Paragraph 1...
        
* list item 1
* list item 2
* list item 3
    </markdown>

JavaScript

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

markdownDemo.directive('markdown', function() {
    var showdown = new Showdown.converter(),
        template = '<section>' +
                     '<article ng-bind-html-unsafe="markdown(content)"></article>' +
                     '<textarea ng-model="content" rows=10"></textarea>' +
                    '</section>'
    
    return {
        restrict: 'E',
        scope: {},
        compile: function(templateElement) {
            var initialContent = templateElement.html();
            templateElement.html(template);
            return function(scope, element, attrs) {
              scope.content = initialContent;
                scope.markdown = showdown.makeHtml;
            }
        }
    }
});