showdown/example/angular.html

83 lines
2.1 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap-theme.min.css">
<style>
html, body {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
#ed-txt-area {
width: 100%;
height: 100%;
min-height: 400px;
box-sizing: border-box;
resize: vertical;
display: block;
padding: 9px;
font-size: 12px;
line-height: 1.42857143;
color: #333;
word-break: break-all;
word-wrap: break-word;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
#banner {
text-align: center;
}
</style>
</head>
<body ng-app="showdownTest">
<div id="banner" class="jumbotron">
<h1>Angular Showdown</h1>
<h3>Showdown integration with angular</h3>
</div>
<div class="container" data-ng-controller="shTestCtrl">
<div class="row">
<div class="col-md-6">
<h2>Markdown</h2>
<textarea id="ed-txt-area" data-ng-model="mdText"></textarea>
<p>*for syntax.txt to load, requires a localhost server</p>
</div>
<div class="col-md-6">
<h2>HTML</h2>
<div data-sd-model-to-html="mdText"></div>
</div>
</div>
</div>
<script src="../src/showdown.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script src="../src/ng-showdown.js"></script>
<script>
var shTest = angular.module('showdownTest', ['Showdown']);
shTest.controller('shTestCtrl', ['$scope', '$http', function ($scope, $http) {
$scope.mdText = '**foo**';
$http.get('syntax.txt').then(
function (data) {
$scope.mdText = data.data;
},
function (error) {
console.log(error);
alert("couldn't load syntax.txt");
}
)
}]);
</script>
</body>
</html>