I have tried several ways to write and organize my personal memo. I used to use Twiki, Trac, etc. But wiki is too much. You have to set up web server and write document on your browser. So I wanted another way which is easier than wiki. I was looking for something like this. The data is text file, but it’s possible to customize the presentation.
I found that Markdown is the one. I can write it as text. And I can customize the design with css when I need to. So I’ve written markdown viewer with simple HTML and Javascript (Javascript with jQuery and Showdown.)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="screen" href="" />
<title>Markdown Viewer</title>
</head>
<body>
<div id="markdownContents"></div>
<!-- Load Javascript libraries -->
<script type="text/javascript" src="./jquery-1.2.3.js"></script>
<script type="text/javascript" src="./showdown.js"></script>
<!-- Main -->
<script type="text/javascript">
//<![CDATA[
// Load Markdown contents
var directory = "./path/to/markdown/docs";
var filename = "filename.txt";
var path = directory + "/" + filename;md2html(path);
function md2html(path){
// Load contents and convert to HTML
$("#markdownContents").load(path, function(text, status){
var sdconv = new Showdown.converter();
this.innerHTML = sdconv.makeHtml(text);
});
}
//]]>
</script>
</body>
</html>