Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

built the prototype and wrote the beginnings of a doc

  • Loading branch information...
commit 3170888984f0349175c7df593a873a44ab916617 1 parent f2071d6
@mgan59 authored
View
2  .gitignore
@@ -0,0 +1,2 @@
+node_modules/*
+output/*.html
View
14 README.markdown
@@ -1,3 +1,13 @@
-# DocDown
+# DocDown - What is it?
-Party Started
+Currently I tend to write most documents using markdown and as of recently I was writing technical documentation all in markdown and needed a way to take the markdown and convert it to a self container HTML document that I would share with others. I had looked on Github and found several blogging engines built around markdown files being converted to html and served via express. That isn't what I needed. So I wrote DocDown as a simple personal tool to help with my productivity. Maybe it will help you as well.
+
+# How to use it
+
+Well you will need nodejs and npm, if you haven't used those yet go find a tutorial and get started :)
+
+Once you have npm install the dependencies
+
+Currently there is only one layout and all your markdown must go in the myMarkdownSource. I was in a hurry building this so I haven't written the code to do command line options parsing. Sorry had a deadline and just needed this to work :)
+
+So in the pipe is the ability to pass file handlers into the app, and maybe a bash script to help harness the app or if I figure out how to package into npm I can make it entirely standalone.
View
25 docdown.js
@@ -0,0 +1,25 @@
+var markdownParser = require('./node_modules/markdown-js/lib/markdown').markdown;
+var argv = require('./node_modules/optimist').argv;
+var fs = require('fs');
+
+var markdownInput = 'myMarkdownSource.markdown';
+var outputPath = './output/test.html';
+var input = '# Header';
+//console.log(input);
+
+
+var sourceMarkdownFile = fs.readFileSync(markdownInput, 'utf-8');
+
+// Read in a layout file, only one for now
+var layoutFile = fs.readFile('./layouts/standard.html', 'utf-8', function(err, buff){
+ var replaceText = markdownParser(sourceMarkdownFile);
+ //replace text
+ var newDoc = buff.replace('__markdown__', replaceText);
+
+ fs.writeFile(outputPath, newDoc, function(err){
+ if(err) throw err;
+ console.log('Document Generated... You Win!');
+ });
+
+});
+
View
124 layouts/standard.html
@@ -0,0 +1,124 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Doc Test</title>
+ <meta charset="utf-8">
+ <meta name="author" content="Morgan Craft">
+ <meta name="generator" content="DocDown" />
+ <style>
+ html,body,h1,h2,h3,h4,h5,h6,p,blockquote,pre,code,em,img,small,strong,sub,sup,b,i,dl,dt,dd,ol,ul,li,table,tbody,tfoot,thead,tr,th,td {
+ background:transparent;
+ border:0;
+ font-size:100%;
+ margin:0;
+ padding:0;
+ outline:0;
+ vertical-align:baseline
+ }
+
+ body {
+ background-color:#FFFFFF;
+ color:#222222;
+ font:normal normal 400 100%/1.5em serif;
+ margin:0 0 0 20px;
+ width:1100px;
+ }
+
+ a {
+ background-color:transparent;
+ font-size:100%;
+ margin:0;
+ padding:0;
+ vertical-align:baseline
+ }
+
+ hr {
+ border:0;
+ border-top:1px solid #CCCCCC;
+ display:block;
+ height:1px;
+ margin:1em 0;
+ padding:0
+ }
+
+ h1,h2,h3,h4,h5,h6,dl,ol,ul,p,blockquote,pre {
+ margin-bottom:1em;
+ margin-top:1em
+ }
+
+ ol, ul {
+ margin-left:40px
+ }
+
+ dd,dt,li {
+ display:list-item outside
+ }
+
+ blockquote {
+ border-left:solid .1em #DDD;
+ padding-left:1.4em;
+ quotes:none
+ }
+
+ blockquote ol,
+ blockquote ul {
+ margin-left:1.5em
+ }
+
+ code {
+ background-color:#FFEEEE;
+ font-family:monospace, sans-serif;
+ font-size:87.5%;
+ margin-bottom:-.125em;
+ margin-left:.125em;
+ margin-right:.125em;
+ margin-top:-.125em;
+ padding:.125em;
+ padding-bottom:1em;
+ overflow:auto;
+ }
+
+ pre {
+ background-color:#FFE;
+ padding:.75em
+ }
+
+ pre code {
+ display:block;
+ margin:0
+ }
+
+ h1 {
+ font-size:1.5em
+ }
+
+ h2 {
+ font-size:1.3125em
+ }
+
+ h3 {
+ font-size:1.125em
+ }
+
+ h4 {
+ font-size:1em
+ }
+
+ h5 {
+ font-size:1em
+ }
+
+ h6 {
+ font-size:1em
+ }
+
+ table {
+ border-collapse:collapse;
+ width:100%
+ }
+ </style>
+</head>
+<body>
+__markdown__
+</body>
+</html>
View
12 myMarkdownSource.markdown
@@ -0,0 +1,12 @@
+# My Special Doc
+
+this is a standard paragraph, don't laugh!
+
+* now I type some stuff in here
+* another list
+
+Now bck to paragraphs
+
+## now a h2
+
+okay more text
Please sign in to comment.
Something went wrong with that request. Please try again.