Skip to content

Commit

Permalink
add md2html
Browse files Browse the repository at this point in the history
  • Loading branch information
theo-armour committed May 9, 2015
1 parent 9b7f0ec commit 202ae0e
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 0 deletions.
37 changes: 37 additions & 0 deletions md/js/read-markdown-display-html.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

var script = document.body.appendChild( document.createElement( 'script' ) );
script.onload = init;
script.src = 'http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js';

function init() {

document.body.style.cssText = ' font: bold 12pt monospace; left: 0; margin: 0 auto; max-width:900px; position: absolute; right: 0; ';

var info = document.body.appendChild( document.createElement( 'div' ) );

var fileName = location.hash ? location.hash.split( '#' )[1] : 'readme.md';
document.title = document.title ? document.title : fileName;

var xmlHttp = new XMLHttpRequest();
xmlHttp.open( 'GET', fileName, true );
xmlHttp.onreadystatechange = function() {

info.innerHTML = xmlHttp.readyState === 4 ? new Showdown.converter().makeHtml( xmlHttp.responseText ) : '';

};

xmlHttp.send( null );

}

/*
View only on GitHub
<span style=display:none; >[View as web page]( http://wikihouse.github.io/viewer-experiments/ "view the file as a web page." ) </span>
View the following only on the web page
<input type=button value='Source code on GitHub' onclick=window.location.href='http://github.com/wikihouse/viewer-experiments/tree/gh-pages/'; />
*/
50 changes: 50 additions & 0 deletions md2html/index-all-in-one.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!doctype html>
<html lang=en >
<head>
<title>Jaanga MD to HTML All in One</title>
<meta charset=utf-8 />
</head>
<body>
<script>
// http://jaanga.github.io/libs/md2html/

var script = document.body.appendChild( document.createElement( 'script' ) );
script.onload = init;
script.src = 'http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js';

function init() {

document.body.style.cssText = ' font: bold 12pt monospace; left: 0; margin: 0 auto; max-width:900px; position: absolute; right: 0; ';

var info = document.body.appendChild( document.createElement( 'div' ) );

var fileName = location.hash ? location.hash.split( '#' )[1] : 'readme.md';
document.title = document.title ? document.title : fileName;

var xmlHttp = new XMLHttpRequest();
xmlHttp.open( 'GET', fileName, true );
xmlHttp.onreadystatechange = function() {

info.innerHTML = xmlHttp.readyState === 4 ? new Showdown.converter().makeHtml( xmlHttp.responseText ) : '';

};

xmlHttp.send( null );

}

/*
View only on GitHub
<span style=display:none; >[View as web page]( http://wikihouse.github.io/viewer-experiments/ "view the file as a web page." ) </span>
View the following only on the web page
<input type=button value='Source code on GitHub' onclick=window.location.href='http://github.com/wikihouse/viewer-experiments/tree/gh-pages/'; />
*/

</script>
</body>
</html>
10 changes: 10 additions & 0 deletions md2html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<html lang=en >
<head>
<title>Jaanga MD to HTML</title>
<meta charset=utf-8 />
</head>
<body>
<script src =http://jaanga.github.io/libs/md2html/read-markdown-display-html.js ></script>
</body>
</html>
37 changes: 37 additions & 0 deletions md2html/js/read-markdown-display-html.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

var script = document.body.appendChild( document.createElement( 'script' ) );
script.onload = init;
script.src = 'http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js';

function init() {

document.body.style.cssText = ' font: bold 12pt monospace; left: 0; margin: 0 auto; max-width:900px; position: absolute; right: 0; ';

var info = document.body.appendChild( document.createElement( 'div' ) );

var fileName = location.hash ? location.hash.split( '#' )[1] : 'readme.md';
document.title = document.title ? document.title : fileName;

var xmlHttp = new XMLHttpRequest();
xmlHttp.open( 'GET', fileName, true );
xmlHttp.onreadystatechange = function() {

info.innerHTML = xmlHttp.readyState === 4 ? new Showdown.converter().makeHtml( xmlHttp.responseText ) : '';

};

xmlHttp.send( null );

}

/*
View only on GitHub
<span style=display:none; >[View as web page]( http://wikihouse.github.io/viewer-experiments/ "view the file as a web page." ) </span>
View the following only on the web page
<input type=button value='Source code on GitHub' onclick=window.location.href='http://github.com/wikihouse/viewer-experiments/tree/gh-pages/'; />
*/
10 changes: 10 additions & 0 deletions md2html/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Markdown to HTML
===

View only on GitHub
<span style=display:none; >[View as web page]( http://jaanga.github.io/libs/md2html/ "view the file as a web page." ) </span>


View the following only on the web page
<input type=button value='Source code on GitHub' onclick=window.location.href='https://github.com/jaanga/libs/md2html/ '; />

0 comments on commit 202ae0e

Please sign in to comment.