creat
This commit is contained in:
parent
f62ee3082a
commit
a9cdcdf2d5
3 changed files with 1404 additions and 0 deletions
7
javascript/md2html/README.md
Normal file
7
javascript/md2html/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
md2html
|
||||
=======
|
||||
|
||||
できること
|
||||
--------
|
||||
- MarkdownをHTMLにする
|
||||
- showdown.jsを使用
|
56
javascript/md2html/md2html.html
Normal file
56
javascript/md2html/md2html.html
Normal file
|
@ -0,0 +1,56 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="ja">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>md2html</title>
|
||||
<link rel="stylesheet" href="http://kou029w.appspot.com/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="http://kou029w.appspot.com/css/bootstrap-responsive.min.css">
|
||||
</head>
|
||||
<body class="container">
|
||||
<h1>md2html</h1>
|
||||
<p><a href="#" id="jisaz" class="btn btn-danger"><i class="icon-remove icon-white"></i> 編集をやめます</a></p>
|
||||
<div class="row">
|
||||
<div class="span6"><textarea id="markdown" class="span6" autofocus></textarea></div>
|
||||
<div class="span6">
|
||||
<blockquote id='html'></blockquote>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer muted">
|
||||
<hr>
|
||||
©2012 <a href="http://twitter.com/kou029w">@kou029w</a> - <a href="http://creativecommons.org/licenses/by/2.1/jp/">CC BY</a>
|
||||
</div>
|
||||
<style>
|
||||
#markdown {
|
||||
font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
<script src="http://code.jquery.com/jquery-latest.js"></script>
|
||||
<script src="http://kou029w.appspot.com/js/bootstrap.min.js"></script>
|
||||
<script src="showdown.js"></script>
|
||||
<script>
|
||||
var d = new Date();
|
||||
var yyyy = d.getFullYear();
|
||||
var mm = d.getMonth();
|
||||
mm++;
|
||||
if(mm < 10) mm = "0" + mm;
|
||||
var dd = d.getDate();
|
||||
if(dd < 10) dd = "0" + dd;
|
||||
var date = Array(yyyy,mm,dd).join('-');
|
||||
$('#markdown').text(date+' ');
|
||||
var md = $('#markdown').val();
|
||||
var sd = new Showdown.converter();
|
||||
var html = sd.makeHtml(md);
|
||||
$('#html').html(html);
|
||||
$('#markdown').keyup(function(e){
|
||||
md = $('#markdown').val();
|
||||
html = sd.makeHtml(md);
|
||||
$('#html').html(html);
|
||||
});
|
||||
$("#jisaz").click(function(){
|
||||
document.title = md.split('\n')[0].replace(/^#*\s*(.*?)\s*#*$/,'$1');
|
||||
$('body').html('\n\n'+html+'\n\n');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
1341
javascript/md2html/showdown.js
Normal file
1341
javascript/md2html/showdown.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue