Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

works

  • Loading branch information...
commit b6fc52920f13d300936b0e713e7376999ddc4c2e 1 parent 07d2f2b
@ttezel authored
Showing with 7,667 additions and 838 deletions.
  1. +63 −7 docs/buildConfig.html → api.html
  2. +72 −0 api.md
  3. +1 −1  bin/writeme
  4. +1 −2  default-config.json
  5. +0 −14 docs/buildConfig.md
  6. +0 −190 docs/generateDocs.html
  7. +0 −6 docs/generateDocs.md
  8. +0 −190 docs/makeDocDirectory.html
  9. +0 −6 docs/makeDocDirectory.md
  10. +0 −191 docs/renderDoc.html
  11. +0 −7 docs/renderDoc.md
  12. +0 −9 docs/writeme.md
  13. +0 −15 examples/no-config/readme.html
  14. +30 −7 docs/writeme.html → examples/with-config/readme.html
  15. +22 −2 examples/{no-config → with-config}/readme.md
  16. +17 −15 lib/buildConfig.js
  17. +27 −24 lib/generateDocs.js
  18. +49 −0 lib/initializeDoc.js
  19. +4 −4 lib/makeDocDirectory.js
  20. +0 −134 lib/renderDoc.js
  21. +86 −0 lib/renderDocs.js
  22. +7 −7 { → lib}/writeme.js
  23. +7 −0 node_modules/showdown/.gitattributes
  24. +3 −0  node_modules/showdown/.npmignore
  25. +4 −0 node_modules/showdown/.travis.yml
  26. +327 −0 node_modules/showdown/README.md
  27. +5 −0 node_modules/showdown/compressed/extensions/github.js
  28. +6 −0 node_modules/showdown/compressed/extensions/google-prettify.js
  29. +6 −0 node_modules/showdown/compressed/extensions/twitter.js
  30. +62 −0 node_modules/showdown/compressed/showdown.js
  31. +720 −0 node_modules/showdown/example/showdown-gui.html
  32. +349 −0 node_modules/showdown/example/showdown-gui.js
  33. +30 −0 node_modules/showdown/grunt.js
  34. +34 −0 node_modules/showdown/license.txt
  35. +80 −0 node_modules/showdown/package.json
  36. +30 −0 node_modules/showdown/perlMarkdown/Markdown License.txt
  37. +1,509 −0 node_modules/showdown/perlMarkdown/Markdown-1.0.2b2.pl
  38. +1,642 −0 node_modules/showdown/perlMarkdown/Markdown-1.0.2b7.pl
  39. +13 −0 node_modules/showdown/perlMarkdown/readme.txt
  40. +25 −0 node_modules/showdown/src/extensions/github.js
  41. +29 −0 node_modules/showdown/src/extensions/prettify.js
  42. +105 −0 node_modules/showdown/src/extensions/table.js
  43. +42 −0 node_modules/showdown/src/extensions/twitter.js
  44. +1,454 −0 node_modules/showdown/src/showdown.js
  45. +5 −0 node_modules/showdown/test/cases/anchors-by-reference.html
  46. +11 −0 node_modules/showdown/test/cases/anchors-by-reference.md
  47. +2 −0  node_modules/showdown/test/cases/automatic-anchors.html
  48. +2 −0  node_modules/showdown/test/cases/automatic-anchors.md
  49. +13 −0 node_modules/showdown/test/cases/blockquote-nested-markdown.html
  50. +8 −0 node_modules/showdown/test/cases/blockquote-nested-markdown.md
  51. +5 −0 node_modules/showdown/test/cases/blockquote.html
  52. +4 −0 node_modules/showdown/test/cases/blockquote.md
  53. +5 −0 node_modules/showdown/test/cases/code-block-html-escape.html
  54. +4 −0 node_modules/showdown/test/cases/code-block-html-escape.md
  55. +5 −0 node_modules/showdown/test/cases/code-block.html
  56. +4 −0 node_modules/showdown/test/cases/code-block.md
  57. +5 −0 node_modules/showdown/test/cases/doubline-list.html
  58. +4 −0 node_modules/showdown/test/cases/doubline-list.md
  59. +8 −0 node_modules/showdown/test/cases/emphasis.html
  60. +8 −0 node_modules/showdown/test/cases/emphasis.md
  61. +1 −0  node_modules/showdown/test/cases/escaped-number-period.html
  62. +1 −0  node_modules/showdown/test/cases/escaped-number-period.md
  63. +32 −0 node_modules/showdown/test/cases/escaping.html
  64. +32 −0 node_modules/showdown/test/cases/escaping.md
  65. +7 −0 node_modules/showdown/test/cases/github-style-at-start.html
  66. +7 −0 node_modules/showdown/test/cases/github-style-at-start.md
  67. +13 −0 node_modules/showdown/test/cases/github-style-codeblock.html
  68. +14 −0 node_modules/showdown/test/cases/github-style-codeblock.md
  69. +4 −0 node_modules/showdown/test/cases/github-style-linebreaks.html
  70. +4 −0 node_modules/showdown/test/cases/github-style-linebreaks.md
  71. +1 −0  node_modules/showdown/test/cases/h1-with-double-hash.html
  72. +1 −0  node_modules/showdown/test/cases/h1-with-double-hash.md
  73. +1 −0  node_modules/showdown/test/cases/h1-with-equals.html
  74. +2 −0  node_modules/showdown/test/cases/h1-with-equals.md
  75. +1 −0  node_modules/showdown/test/cases/h1-with-single-hash.html
  76. +1 −0  node_modules/showdown/test/cases/h1-with-single-hash.md
  77. +1 −0  node_modules/showdown/test/cases/h2-with-dashes.html
  78. +2 −0  node_modules/showdown/test/cases/h2-with-dashes.md
  79. +1 −0  node_modules/showdown/test/cases/h2-with-double-hash.html
  80. +1 −0  node_modules/showdown/test/cases/h2-with-double-hash.md
  81. +1 −0  node_modules/showdown/test/cases/h2-with-single-hash.html
  82. +1 −0  node_modules/showdown/test/cases/h2-with-single-hash.md
  83. +1 −0  node_modules/showdown/test/cases/h3-with-double-hash.html
  84. +1 −0  node_modules/showdown/test/cases/h3-with-double-hash.md
  85. +1 −0  node_modules/showdown/test/cases/h3-with-single-hash.html
  86. +1 −0  node_modules/showdown/test/cases/h3-with-single-hash.md
  87. +1 −0  node_modules/showdown/test/cases/h4-with-single-hash.html
  88. +1 −0  node_modules/showdown/test/cases/h4-with-single-hash.md
  89. +1 −0  node_modules/showdown/test/cases/h5-with-single-hash.html
  90. +1 −0  node_modules/showdown/test/cases/h5-with-single-hash.md
  91. +1 −0  node_modules/showdown/test/cases/h6-with-single-hash.html
  92. +1 −0  node_modules/showdown/test/cases/h6-with-single-hash.md
  93. +10 −0 node_modules/showdown/test/cases/horizontal-rules.html
  94. +10 −0 node_modules/showdown/test/cases/horizontal-rules.md
  95. +23 −0 node_modules/showdown/test/cases/html5-strutural-tags.html
  96. +16 −0 node_modules/showdown/test/cases/html5-strutural-tags.md
  97. +6 −0 node_modules/showdown/test/cases/images.html
  98. +8 −0 node_modules/showdown/test/cases/images.md
  99. +2 −0  node_modules/showdown/test/cases/implicit-anchors.html
  100. +5 −0 node_modules/showdown/test/cases/implicit-anchors.md
  101. +4 −0 node_modules/showdown/test/cases/inline-anchors.html
  102. +4 −0 node_modules/showdown/test/cases/inline-anchors.md
  103. +12 −0 node_modules/showdown/test/cases/inline-code.html
  104. +12 −0 node_modules/showdown/test/cases/inline-code.md
  105. +3 −0  node_modules/showdown/test/cases/inline-escaped-chars.html
  106. +3 −0  node_modules/showdown/test/cases/inline-escaped-chars.md
  107. +6 −0 node_modules/showdown/test/cases/inline-style-tag.html
  108. +6 −0 node_modules/showdown/test/cases/inline-style-tag.md
  109. +5 −0 node_modules/showdown/test/cases/lazy-blockquote.html
  110. +4 −0 node_modules/showdown/test/cases/lazy-blockquote.md
  111. +8 −0 node_modules/showdown/test/cases/list-with-blockquote.html
  112. +4 −0 node_modules/showdown/test/cases/list-with-blockquote.md
  113. +6 −0 node_modules/showdown/test/cases/list-with-code.html
  114. +3 −0  node_modules/showdown/test/cases/list-with-code.md
  115. +6 −0 node_modules/showdown/test/cases/multi-paragraph-list.html
  116. +6 −0 node_modules/showdown/test/cases/multi-paragraph-list.md
  117. +5 −0 node_modules/showdown/test/cases/multiline-unordered-list.html
  118. +4 −0 node_modules/showdown/test/cases/multiline-unordered-list.md
  119. +9 −0 node_modules/showdown/test/cases/nested-blockquote.html
  120. +6 −0 node_modules/showdown/test/cases/nested-blockquote.md
  121. +5 −0 node_modules/showdown/test/cases/ordered-list-same-number.html
  122. +4 −0 node_modules/showdown/test/cases/ordered-list-same-number.md
  123. +5 −0 node_modules/showdown/test/cases/ordered-list-wrong-numbers.html
  124. +4 −0 node_modules/showdown/test/cases/ordered-list-wrong-numbers.md
  125. +5 −0 node_modules/showdown/test/cases/ordered-list.html
  126. +4 −0 node_modules/showdown/test/cases/ordered-list.md
  127. +2 −0  node_modules/showdown/test/cases/relative-anchors.html
  128. +2 −0  node_modules/showdown/test/cases/relative-anchors.md
  129. +1 −0  node_modules/showdown/test/cases/simple-paragraph.html
  130. +2 −0  node_modules/showdown/test/cases/simple-paragraph.md
  131. +6 −0 node_modules/showdown/test/cases/strong.html
  132. +6 −0 node_modules/showdown/test/cases/strong.md
  133. +5 −0 node_modules/showdown/test/cases/unordered-list-asterisk.html
  134. +4 −0 node_modules/showdown/test/cases/unordered-list-asterisk.md
  135. +5 −0 node_modules/showdown/test/cases/unordered-list-minus.html
  136. +4 −0 node_modules/showdown/test/cases/unordered-list-minus.md
  137. +5 −0 node_modules/showdown/test/cases/unordered-list-plus.html
  138. +4 −0 node_modules/showdown/test/cases/unordered-list-plus.md
  139. +2 −0  node_modules/showdown/test/cases/url-with-parenthesis.html
  140. +2 −0  node_modules/showdown/test/cases/url-with-parenthesis.md
  141. +5 −0 node_modules/showdown/test/extensions/github/basic.html
  142. +3 −0  node_modules/showdown/test/extensions/github/basic.md
  143. +7 −0 node_modules/showdown/test/extensions/prettify/basic.html
  144. +6 −0 node_modules/showdown/test/extensions/prettify/basic.md
  145. +21 −0 node_modules/showdown/test/extensions/table/basic.html
  146. +4 −0 node_modules/showdown/test/extensions/table/basic.md
  147. +48 −0 node_modules/showdown/test/extensions/table/large.html
  148. +7 −0 node_modules/showdown/test/extensions/table/large.md
  149. +21 −0 node_modules/showdown/test/extensions/table/with-equals.html
  150. +4 −0 node_modules/showdown/test/extensions/table/with-equals.md
  151. +33 −0 node_modules/showdown/test/extensions/table/with-surroundings.html
  152. +16 −0 node_modules/showdown/test/extensions/table/with-surroundings.md
  153. +11 −0 node_modules/showdown/test/extensions/table/without-body.html
  154. +2 −0  node_modules/showdown/test/extensions/table/without-body.md
  155. +1 −0  node_modules/showdown/test/extensions/table/without-header-delimiter.html
  156. +1 −0  node_modules/showdown/test/extensions/table/without-header-delimiter.md
  157. +5 −0 node_modules/showdown/test/extensions/twitter/basic.html
  158. +5 −0 node_modules/showdown/test/extensions/twitter/basic.md
  159. +86 −0 node_modules/showdown/test/run.js
  160. +13 −6 templates/default.md
  161. +2 −1  writeme-config.json
View
70 docs/buildConfig.html → api.html
@@ -181,18 +181,74 @@
.vi{color:#008080;}
.il{color:#099;}
</style>
-<h1>writeme</h1>
-<h2>lib/buildConfig.js</h2>
-<h3>module.exports()</h3>
+<h1 id="writeme">writeme</h1>
+
+<h2 id="libbuildconfigjs">lib/buildConfig.js</h2>
+
+<h3 id="moduleexports">module.exports()</h3>
+
<p>Build self.config, call @callback on completion.</p>
-<p>Default config <code>include</code> array includes all .js files found in root, excluding the<br />default ignore list and files/directories prefixed with &#39;.&#39;</p>
+<p>Default config <code>include</code> array includes all .js files found in root, excluding the<br />default ignore list and files/directories prefixed with '.'</p>
<p>All config paths are relative to root where <code>writeme</code> is run.</p>
<h2>Config options</h2>
-<p><p><code>include</code>: array of files to document (all other files will be ignored)<br /><code>template_path</code>: path to mustache template to use for rendering docs<br /><code>css_path</code>: path to css file to use for docs (defaults to gfm)<br /><code>doc_dir</code>: directory to put docs in<br /><code>concat</code>: if specified, all docs will be output to two files with the <code>concat</code> string as the basename (defaults to readme.md &amp; readme.html)</p>
-param <code>cb</code>: <strong>Function</strong> completion callback. Signature: function (err)<br/>
-</p>
+<p><code>include</code>: array of files to document (all other files will be ignored)<br /><code>template_path</code>: path to mustache template to use for rendering docs<br /><code>css_path</code>: path to css file to use for docs (defaults to gfm)<br /><code>doc_base</code>: path (and basename) of docs output. <br />All docs will be output to two files with the <code>doc_base</code> string as the basename. <br />(eg. a value of <code>./readme</code> will output a readme.md &amp; readme.html)</p>
+
+<p>param <code>cb</code>: <strong>Function</strong> completion callback. Signature: function (err)<br/>
+<br/></p>
+
+<h2 id="libgeneratedocsjs">lib/generateDocs.js</h2>
+
+<h3 id="moduleexports">module.exports()</h3>
+
+<p>Traverse down the root and run .renderDoc() as files are discovered.</p>
+
+<p>param <code>cb</code>: <strong>function</strong> completion callback. Function (err)<br/>
+<br/></p>
+
+<h2 id="libinitializedocjs">lib/initializeDoc.js</h2>
+
+<h3 id="moduleexports">module.exports()</h3>
+
+<p>initialize doc (write css) and cache config.template_path</p>
+
+<p>param <code>cb</code>: <strong>Function</strong> completion callback. Signature: function (err)<br/>
+<br/></p>
+
+<h2 id="libmakedocdirectoryjs">lib/makeDocDirectory.js</h2>
+
+<h3 id="moduleexports">module.exports()</h3>
+
+<p>Create directory to put docs in and set self.docPath.</p>
+
+<p>param <code>cb</code>: <strong>Function</strong> completion callback. Signature: function (err)<br/>
+<br/></p>
+
+<h2 id="librenderdocsjs">lib/renderDocs.js</h2>
+
+<h3 id="moduleexports">module.exports()</h3>
+
+<p>Run <code>dox</code> on @file, render markdown &amp; html, then write to doc files</p>
+
+<p>param <code>files</code>: <strong>array</strong> array of absolute paths of files to document<br/>
+<br/></p>
+
+<h2 id="libwritemejs">lib/writeme.js</h2>
+
+<h3 id="writeme">Writeme()</h3>
+
+<p>Writeme class</p>
+
+<p>Sets up writeme configuration, and kicks off the doc generation</p>
+
+<p>param <code>root</code>: <strong>String</strong> absolute path to the directory (or file) to be documented<br/>
+<br/></p>
+
+<h3 id="writemeprototype">Writeme.prototype</h3>
+
+<p>Attach prototype methods from lib directory</p>
+<p><br/></p>
View
72 api.md
@@ -0,0 +1,72 @@
+#writeme
+
+##lib/buildConfig.js
+###module.exports()
+<p>Build self.config, call @callback on completion.</p>
+
+<p>Default config <code>include</code> array includes all .js files found in root, excluding the<br />default ignore list and files/directories prefixed with '.'</p>
+
+<p>All config paths are relative to root where <code>writeme</code> is run.</p>
+
+<h2>Config options</h2>
+
+<p><code>include</code>: array of files to document (all other files will be ignored)<br /><code>template_path</code>: path to mustache template to use for rendering docs<br /><code>css_path</code>: path to css file to use for docs (defaults to gfm)<br /><code>doc_base</code>: path (and basename) of docs output. <br />All docs will be output to two files with the <code>doc_base</code> string as the basename. <br />(eg. a value of <code>./readme</code> will output a readme.md &amp; readme.html)</p>
+param `cb`: **Function** completion callback. Signature: function (err)<br/>
+<br/>
+
+
+
+
+##lib/generateDocs.js
+###module.exports()
+<p>Traverse down the root and run .renderDoc() as files are discovered.</p>
+param `cb`: **function** completion callback. Function (err)<br/>
+<br/>
+
+
+
+
+##lib/initializeDoc.js
+###module.exports()
+<p>initialize doc (write css) and cache config.template_path</p>
+param `cb`: **Function** completion callback. Signature: function (err)<br/>
+<br/>
+
+
+
+
+##lib/makeDocDirectory.js
+###module.exports()
+<p>Create directory to put docs in and set self.docPath.</p>
+param `cb`: **Function** completion callback. Signature: function (err)<br/>
+<br/>
+
+
+
+
+##lib/renderDocs.js
+###module.exports()
+<p>Run <code>dox</code> on @file, render markdown &amp; html, then write to doc files</p>
+param `files`: **array** array of absolute paths of files to document<br/>
+<br/>
+
+
+
+
+##lib/writeme.js
+###Writeme()
+<p>Writeme class</p>
+
+<p>Sets up writeme configuration, and kicks off the doc generation</p>
+param `root`: **String** absolute path to the directory (or file) to be documented<br/>
+<br/>
+
+
+###Writeme.prototype
+<p>Attach prototype methods from lib directory</p>
+<br/>
+
+
+
+
+
View
2  bin/writeme
@@ -1,6 +1,6 @@
#!/usr/bin/env node
-var Writeme = require('../writeme')
+var Writeme = require('../lib/writeme')
console.log(('\nwriteme starting in '+process.cwd()).green)
View
3  default-config.json
@@ -1,5 +1,4 @@
{
"include": [],
- "doc_dir": ".",
- "output": "readme"
+ "doc_base": "readme"
}
View
14 docs/buildConfig.md
@@ -1,14 +0,0 @@
-#writeme
-##lib/buildConfig.js
-
-###module.exports()
-<p>Build self.config, call @callback on completion.</p>
-
-<p>Default config <code>include</code> array includes all .js files found in root, excluding the<br />default ignore list and files/directories prefixed with '.'</p>
-
-<p>All config paths are relative to root where <code>writeme</code> is run.</p>
-
-<h2>Config options</h2>
-
-<p><code>include</code>: array of files to document (all other files will be ignored)<br /><code>template_path</code>: path to mustache template to use for rendering docs<br /><code>css_path</code>: path to css file to use for docs (defaults to gfm)<br /><code>doc_dir</code>: directory to put docs in<br /><code>concat</code>: if specified, all docs will be output to two files with the <code>concat</code> string as the basename (defaults to readme.md &amp; readme.html)</p>
-param `cb`: **Function** completion callback. Signature: function (err)<br/>
View
190 docs/generateDocs.html
@@ -1,190 +0,0 @@
-<style>
-/*
-Some basic Github styles and syntax highlighting CSS via Pygments.
-*/
-html {
- font-size: 14px;
- line-height: 1.6;
- font-family: helvetica,arial,freesans,clean,sans-serif;
- color: black;
-}
-body {
- box-shadow: 0px 0px 0px 3px #eee;
- border: 1px solid #CACACA;
- width: 852px;
- padding: 30px;
- margin: auto;
- margin-top: 20px;
-}
-h1 {
- margin: 15px 0;
- padding-bottom: 2px;
- font-size: 24px;
- border-bottom: 1px solid #EEE;
-}
-h2 {
- margin: 20px 0 10px 0;
- font-size: 18px;
-}
-h3 {
- margin: 20px 0 10px 0;
- padding-bottom: 2px;
- font-size: 14px;
- border-bottom: 1px solid #DDD;
-}
-h4 {
- font-size: 14px;
- line-height: 26px;
- padding: 18px 0 4px;
- font-weight: bold;
- text-transform: uppercase;
-}
-h5 {
- font-size: 13px;
- line-height: 26px;
- padding: 14px 0 0;
- font-weight: bold;
- text-transform: uppercase;
-}
-h6 {
- color: #666;
- font-size: 14px;
- line-height: 26px;
- padding: 18px 0 0;
- font-weight: normal;
- font-variant: italic;
-}
-br+br {
- line-height:0;
- height:0;
- display:none;
-}
-p {
- margin: 1em 0;
-}
-blockquote {
- margin: 14px 0;
- border-left: 4px solid #DDD;
- padding-left: 11px;
- color: #555;
-}
-pre, code {
- font-family: 'Bitstream Vera Sans Mono','Courier',monospace;
-}
-pre {
- background-color: #F8F8F8;
- border: 1px solid #CCC;
- font-size: 13px;
- line-height: 19px;
- overflow: auto;
- padding: 6px 10px;
- border-radius: 3px;
- color: black;
-}
-code {
- margin: 0 2px;
- padding: 2px 5px;
- white-space: nowrap;
- border: 1px solid #CCC;
- background-color: #F8F8F8;
- border-radius: 3px;
- font-size: 12px !important;
-}
-pre > code {
- margin: 0px;
- padding: 0px;
- white-space: pre;
- border: none;
- background-color: transparent;
- border-radius: 0;
-}
-a, a code {
- color: #4183C4;
- text-decoration:none;
-}
-a:hover, a code:hover {
- text-decoration:underline;
-}
-table {
- border-collapse: collapse;
- margin: 20px 0 0;
- padding: 0;
-}
-table tr th, table tr td {
- border: 1px solid #CCC;
- text-align: left;
- margin: 0;
- padding: 6px 13px;
-}
-table tbody tr:nth-child(2n-1) {
- background-color: #F8F8F8;
-}
-
-.c{color:#998;font-style:italic;}
-.err{color:#a61717;background-color:#e3d2d2;}
-.k{font-weight:bold;}
-.o{font-weight:bold;}
-.cm{color:#998;font-style:italic;}
-.cp{color:#999;font-weight:bold;}
-.c1{color:#998;font-style:italic;}
-.cs{color:#999;font-weight:bold;font-style:italic;}
-.gd{color:#000;background-color:#fdd;}
-.gd .x{color:#000;background-color:#faa;}
-.ge{font-style:italic;}
-.gr{color:#a00;}
-.gh{color:#999;}
-.gi{color:#000;background-color:#dfd;}
-.gi .x{color:#000;background-color:#afa;}
-.go{color:#888;}
-.gp{color:#555;}
-.gs{font-weight:bold;}
-.gu{color:#800080;font-weight:bold;}
-.gt{color:#a00;}
-.kc{font-weight:bold;}
-.kd{font-weight:bold;}
-.kn{font-weight:bold;}
-.kp{font-weight:bold;}
-.kr{font-weight:bold;}
-.kt{color:#458;font-weight:bold;}
-.m{color:#099;}
-.s{color:#d14;}
-.na{color:#008080;}
-.nb{color:#0086B3;}
-.nc{color:#458;font-weight:bold;}
-.no{color:#008080;}
-.ni{color:#800080;}
-.ne{color:#900;font-weight:bold;}
-.nf{color:#900;font-weight:bold;}
-.nn{color:#555;}
-.nt{color:#000080;}
-.nv{color:#008080;}
-.ow{font-weight:bold;}
-.w{color:#bbb;}
-.mf{color:#099;}
-.mh{color:#099;}
-.mi{color:#099;}
-.mo{color:#099;}
-.sb{color:#d14;}
-.sc{color:#d14;}
-.sd{color:#d14;}
-.s2{color:#d14;}
-.se{color:#d14;}
-.sh{color:#d14;}
-.si{color:#d14;}
-.sx{color:#d14;}
-.sr{color:#009926;}
-.s1{color:#d14;}
-.ss{color:#990073;}
-.bp{color:#999;}
-.vc{color:#008080;}
-.vg{color:#008080;}
-.vi{color:#008080;}
-.il{color:#099;}
-</style>
-<h1>writeme</h1>
-<h2>lib/generateDocs.js</h2>
-<h3>module.exports()</h3>
-<p><p>Traverse down the root and run .renderDoc() as files are discovered.</p>
-param <code>cb</code>: <strong>function</strong> completion callback. Function (err)<br/>
-</p>
-
View
6 docs/generateDocs.md
@@ -1,6 +0,0 @@
-#writeme
-##lib/generateDocs.js
-
-###module.exports()
-<p>Traverse down the root and run .renderDoc() as files are discovered.</p>
-param `cb`: **function** completion callback. Function (err)<br/>
View
190 docs/makeDocDirectory.html
@@ -1,190 +0,0 @@
-<style>
-/*
-Some basic Github styles and syntax highlighting CSS via Pygments.
-*/
-html {
- font-size: 14px;
- line-height: 1.6;
- font-family: helvetica,arial,freesans,clean,sans-serif;
- color: black;
-}
-body {
- box-shadow: 0px 0px 0px 3px #eee;
- border: 1px solid #CACACA;
- width: 852px;
- padding: 30px;
- margin: auto;
- margin-top: 20px;
-}
-h1 {
- margin: 15px 0;
- padding-bottom: 2px;
- font-size: 24px;
- border-bottom: 1px solid #EEE;
-}
-h2 {
- margin: 20px 0 10px 0;
- font-size: 18px;
-}
-h3 {
- margin: 20px 0 10px 0;
- padding-bottom: 2px;
- font-size: 14px;
- border-bottom: 1px solid #DDD;
-}
-h4 {
- font-size: 14px;
- line-height: 26px;
- padding: 18px 0 4px;
- font-weight: bold;
- text-transform: uppercase;
-}
-h5 {
- font-size: 13px;
- line-height: 26px;
- padding: 14px 0 0;
- font-weight: bold;
- text-transform: uppercase;
-}
-h6 {
- color: #666;
- font-size: 14px;
- line-height: 26px;
- padding: 18px 0 0;
- font-weight: normal;
- font-variant: italic;
-}
-br+br {
- line-height:0;
- height:0;
- display:none;
-}
-p {
- margin: 1em 0;
-}
-blockquote {
- margin: 14px 0;
- border-left: 4px solid #DDD;
- padding-left: 11px;
- color: #555;
-}
-pre, code {
- font-family: 'Bitstream Vera Sans Mono','Courier',monospace;
-}
-pre {
- background-color: #F8F8F8;
- border: 1px solid #CCC;
- font-size: 13px;
- line-height: 19px;
- overflow: auto;
- padding: 6px 10px;
- border-radius: 3px;
- color: black;
-}
-code {
- margin: 0 2px;
- padding: 2px 5px;
- white-space: nowrap;
- border: 1px solid #CCC;
- background-color: #F8F8F8;
- border-radius: 3px;
- font-size: 12px !important;
-}
-pre > code {
- margin: 0px;
- padding: 0px;
- white-space: pre;
- border: none;
- background-color: transparent;
- border-radius: 0;
-}
-a, a code {
- color: #4183C4;
- text-decoration:none;
-}
-a:hover, a code:hover {
- text-decoration:underline;
-}
-table {
- border-collapse: collapse;
- margin: 20px 0 0;
- padding: 0;
-}
-table tr th, table tr td {
- border: 1px solid #CCC;
- text-align: left;
- margin: 0;
- padding: 6px 13px;
-}
-table tbody tr:nth-child(2n-1) {
- background-color: #F8F8F8;
-}
-
-.c{color:#998;font-style:italic;}
-.err{color:#a61717;background-color:#e3d2d2;}
-.k{font-weight:bold;}
-.o{font-weight:bold;}
-.cm{color:#998;font-style:italic;}
-.cp{color:#999;font-weight:bold;}
-.c1{color:#998;font-style:italic;}
-.cs{color:#999;font-weight:bold;font-style:italic;}
-.gd{color:#000;background-color:#fdd;}
-.gd .x{color:#000;background-color:#faa;}
-.ge{font-style:italic;}
-.gr{color:#a00;}
-.gh{color:#999;}
-.gi{color:#000;background-color:#dfd;}
-.gi .x{color:#000;background-color:#afa;}
-.go{color:#888;}
-.gp{color:#555;}
-.gs{font-weight:bold;}
-.gu{color:#800080;font-weight:bold;}
-.gt{color:#a00;}
-.kc{font-weight:bold;}
-.kd{font-weight:bold;}
-.kn{font-weight:bold;}
-.kp{font-weight:bold;}
-.kr{font-weight:bold;}
-.kt{color:#458;font-weight:bold;}
-.m{color:#099;}
-.s{color:#d14;}
-.na{color:#008080;}
-.nb{color:#0086B3;}
-.nc{color:#458;font-weight:bold;}
-.no{color:#008080;}
-.ni{color:#800080;}
-.ne{color:#900;font-weight:bold;}
-.nf{color:#900;font-weight:bold;}
-.nn{color:#555;}
-.nt{color:#000080;}
-.nv{color:#008080;}
-.ow{font-weight:bold;}
-.w{color:#bbb;}
-.mf{color:#099;}
-.mh{color:#099;}
-.mi{color:#099;}
-.mo{color:#099;}
-.sb{color:#d14;}
-.sc{color:#d14;}
-.sd{color:#d14;}
-.s2{color:#d14;}
-.se{color:#d14;}
-.sh{color:#d14;}
-.si{color:#d14;}
-.sx{color:#d14;}
-.sr{color:#009926;}
-.s1{color:#d14;}
-.ss{color:#990073;}
-.bp{color:#999;}
-.vc{color:#008080;}
-.vg{color:#008080;}
-.vi{color:#008080;}
-.il{color:#099;}
-</style>
-<h1>writeme</h1>
-<h2>lib/makeDocDirectory.js</h2>
-<h3>module.exports()</h3>
-<p><p>Create directory to put docs in and set self.docPath.</p>
-param <code>cb</code>: <strong>Function</strong> completion callback. Signature: function (err)<br/>
-</p>
-
View
6 docs/makeDocDirectory.md
@@ -1,6 +0,0 @@
-#writeme
-##lib/makeDocDirectory.js
-
-###module.exports()
-<p>Create directory to put docs in and set self.docPath.</p>
-param `cb`: **Function** completion callback. Signature: function (err)<br/>
View
191 docs/renderDoc.html
@@ -1,191 +0,0 @@
-<style>
-/*
-Some basic Github styles and syntax highlighting CSS via Pygments.
-*/
-html {
- font-size: 14px;
- line-height: 1.6;
- font-family: helvetica,arial,freesans,clean,sans-serif;
- color: black;
-}
-body {
- box-shadow: 0px 0px 0px 3px #eee;
- border: 1px solid #CACACA;
- width: 852px;
- padding: 30px;
- margin: auto;
- margin-top: 20px;
-}
-h1 {
- margin: 15px 0;
- padding-bottom: 2px;
- font-size: 24px;
- border-bottom: 1px solid #EEE;
-}
-h2 {
- margin: 20px 0 10px 0;
- font-size: 18px;
-}
-h3 {
- margin: 20px 0 10px 0;
- padding-bottom: 2px;
- font-size: 14px;
- border-bottom: 1px solid #DDD;
-}
-h4 {
- font-size: 14px;
- line-height: 26px;
- padding: 18px 0 4px;
- font-weight: bold;
- text-transform: uppercase;
-}
-h5 {
- font-size: 13px;
- line-height: 26px;
- padding: 14px 0 0;
- font-weight: bold;
- text-transform: uppercase;
-}
-h6 {
- color: #666;
- font-size: 14px;
- line-height: 26px;
- padding: 18px 0 0;
- font-weight: normal;
- font-variant: italic;
-}
-br+br {
- line-height:0;
- height:0;
- display:none;
-}
-p {
- margin: 1em 0;
-}
-blockquote {
- margin: 14px 0;
- border-left: 4px solid #DDD;
- padding-left: 11px;
- color: #555;
-}
-pre, code {
- font-family: 'Bitstream Vera Sans Mono','Courier',monospace;
-}
-pre {
- background-color: #F8F8F8;
- border: 1px solid #CCC;
- font-size: 13px;
- line-height: 19px;
- overflow: auto;
- padding: 6px 10px;
- border-radius: 3px;
- color: black;
-}
-code {
- margin: 0 2px;
- padding: 2px 5px;
- white-space: nowrap;
- border: 1px solid #CCC;
- background-color: #F8F8F8;
- border-radius: 3px;
- font-size: 12px !important;
-}
-pre > code {
- margin: 0px;
- padding: 0px;
- white-space: pre;
- border: none;
- background-color: transparent;
- border-radius: 0;
-}
-a, a code {
- color: #4183C4;
- text-decoration:none;
-}
-a:hover, a code:hover {
- text-decoration:underline;
-}
-table {
- border-collapse: collapse;
- margin: 20px 0 0;
- padding: 0;
-}
-table tr th, table tr td {
- border: 1px solid #CCC;
- text-align: left;
- margin: 0;
- padding: 6px 13px;
-}
-table tbody tr:nth-child(2n-1) {
- background-color: #F8F8F8;
-}
-
-.c{color:#998;font-style:italic;}
-.err{color:#a61717;background-color:#e3d2d2;}
-.k{font-weight:bold;}
-.o{font-weight:bold;}
-.cm{color:#998;font-style:italic;}
-.cp{color:#999;font-weight:bold;}
-.c1{color:#998;font-style:italic;}
-.cs{color:#999;font-weight:bold;font-style:italic;}
-.gd{color:#000;background-color:#fdd;}
-.gd .x{color:#000;background-color:#faa;}
-.ge{font-style:italic;}
-.gr{color:#a00;}
-.gh{color:#999;}
-.gi{color:#000;background-color:#dfd;}
-.gi .x{color:#000;background-color:#afa;}
-.go{color:#888;}
-.gp{color:#555;}
-.gs{font-weight:bold;}
-.gu{color:#800080;font-weight:bold;}
-.gt{color:#a00;}
-.kc{font-weight:bold;}
-.kd{font-weight:bold;}
-.kn{font-weight:bold;}
-.kp{font-weight:bold;}
-.kr{font-weight:bold;}
-.kt{color:#458;font-weight:bold;}
-.m{color:#099;}
-.s{color:#d14;}
-.na{color:#008080;}
-.nb{color:#0086B3;}
-.nc{color:#458;font-weight:bold;}
-.no{color:#008080;}
-.ni{color:#800080;}
-.ne{color:#900;font-weight:bold;}
-.nf{color:#900;font-weight:bold;}
-.nn{color:#555;}
-.nt{color:#000080;}
-.nv{color:#008080;}
-.ow{font-weight:bold;}
-.w{color:#bbb;}
-.mf{color:#099;}
-.mh{color:#099;}
-.mi{color:#099;}
-.mo{color:#099;}
-.sb{color:#d14;}
-.sc{color:#d14;}
-.sd{color:#d14;}
-.s2{color:#d14;}
-.se{color:#d14;}
-.sh{color:#d14;}
-.si{color:#d14;}
-.sx{color:#d14;}
-.sr{color:#009926;}
-.s1{color:#d14;}
-.ss{color:#990073;}
-.bp{color:#999;}
-.vc{color:#008080;}
-.vg{color:#008080;}
-.vi{color:#008080;}
-.il{color:#099;}
-</style>
-<h1>writeme</h1>
-<h2>lib/renderDoc.js</h2>
-<h3>module.exports()</h3>
-<p><p>Run <code>dox</code> on @file, render markdown &amp; html, then save in docs directory</p>
-param <code>file</code>: <strong>string</strong> absolute file path to document<br/>
-param <code>stat</code>: <strong>object</strong> file&#39;s stats<br/>
-</p>
-
View
7 docs/renderDoc.md
@@ -1,7 +0,0 @@
-#writeme
-##lib/renderDoc.js
-
-###module.exports()
-<p>Run <code>dox</code> on @file, render markdown &amp; html, then save in docs directory</p>
-param `file`: **string** absolute file path to document<br/>
-param `stat`: **object** file&#39;s stats<br/>
View
9 docs/writeme.md
@@ -1,9 +0,0 @@
-#writeme
-##writeme.js
-
-###Writeme()
-<p>Writeme class</p>
-
-<p>Sets up writeme configuration, and kicks off the doc generation</p>
-param `root`: **String** absolute path to the directory (or file) to be documented<br/>
-<p>Attach prototype methods from lib directory</p>
View
15 examples/no-config/readme.html
@@ -181,18 +181,3 @@
.vi{color:#008080;}
.il{color:#099;}
</style>
-<h1>no-config</h1>
-<h2>class.js</h2>
-<p><p>Testing code for writeme</p>
-</p>
-<h3>Class()</h3>
-<p><p>Class description</p>
-param <code>foo</code>: <strong>string</strong> foo description<br/>
-param <code>bar</code>: <strong>string</strong> bar description<br/>
-</p>
-<h3>Class.prototype.publicMethod()</h3>
-<p><p>publicMethod description</p>
-param <code>baz</code>: <strong>string</strong> baz description<br/>
-return : <strong>boolean</strong> bool description<br/>
-</p>
-
View
37 docs/writeme.html → examples/with-config/readme.html
@@ -181,12 +181,35 @@
.vi{color:#008080;}
.il{color:#099;}
</style>
-<h1>writeme</h1>
-<h2>writeme.js</h2>
-<h3>Writeme()</h3>
-<p>Writeme class</p>
+<h1 id="withconfig">with-config</h1>
-<p>Sets up writeme configuration, and kicks off the doc generation</p>
-param <code>root</code>: <strong>String</strong> absolute path to the directory (or file) to be documented<br/>
-<p>Attach prototype methods from lib directory</p>
+<h2 id="classjs">class.js</h2>
+<p>Testing code for writeme</p>
+
+<p><br/></p>
+
+<h3 id="class">Class()</h3>
+
+<p>Class description</p>
+
+<p>param <code>foo</code>: <strong>string</strong> foo description<br/>
+param <code>bar</code>: <strong>string</strong> bar description<br/>
+<br/></p>
+
+<h3 id="classprototypepublicmethod">Class.prototype.publicMethod()</h3>
+
+<p>publicMethod description</p>
+
+<p>param <code>baz</code>: <strong>string</strong> baz description<br/>
+return : <strong>boolean</strong> bool description<br/>
+<br/></p>
+
+<h3 id="classprototypepublicmethod">Class.prototype.publicMethod()</h3>
+
+<p>privateMethod description</p>
+
+<p>param <code>baz</code>: <strong>string</strong> baz description<br/>
+return : <strong>boolean</strong> bool description<br/>
+api : [object Object]<br/>
+<br/></p>
View
24 examples/no-config/readme.md → examples/with-config/readme.md
@@ -1,12 +1,32 @@
-#no-config
-##class.js
+#with-config
+##class.js
<p>Testing code for writeme</p>
+<br/>
+
+
###Class()
<p>Class description</p>
param `foo`: **string** foo description<br/>
param `bar`: **string** bar description<br/>
+<br/>
+
+
###Class.prototype.publicMethod()
<p>publicMethod description</p>
param `baz`: **string** baz description<br/>
return : **boolean** bool description<br/>
+<br/>
+
+
+###Class.prototype.publicMethod()
+<p>privateMethod description</p>
+param `baz`: **string** baz description<br/>
+return : **boolean** bool description<br/>
+api : [object Object]<br/>
+<br/>
+
+
+
+
+
View
32 lib/buildConfig.js
@@ -19,10 +19,9 @@ var DEFAULT_IGNORE_LIST = [
* `include`: array of files to document (all other files will be ignored)
* `template_path`: path to mustache template to use for rendering docs
* `css_path`: path to css file to use for docs (defaults to gfm)
- * `doc_dir`: directory to put docs in
- * `concat`: if specified, all docs will be output to two files with
- * the `concat` string as the basename, inside of `doc_dir`.
- * (eg. a value of `readme` will output a readme.md & readme.html)
+ * `doc_base`: path (and basename) of docs output.
+ * All docs will be output to two files with the `doc_base` string as the basename.
+ * (eg. a value of `./readme` will output a readme.md & readme.html)
*
* @param {Function} cb completion callback. Signature: function (err)
*/
@@ -44,23 +43,26 @@ module.exports = function buildConfig (cb) {
var userConfig = require(userConfigPath)
- //hash of config keys that need to be relative paths to self.root
- var relativePaths = { template_path: 1, css_path: 1, doc_dir: 1, output: 1 }
-
//override default-config with any user-supplied values
for (var override in userConfig) {
- self.config[override] = relativePaths[override]
- ? path.resolve(self.root, userConfig[override])
- : userConfig[override]
+ self.config[override] = userConfig[override]
}
- return cb(null)
- }
+ //config keys that need to be relative paths to self.root
+ var relativePaths = [ 'template_path', 'css_path', 'doc_base' ]
- //no writeme-config.js found. Notify user and build default config
- console.log('no `writeme-config.json` file found. Using default settings.'.red)
+ //resolve all relative paths to their absolute path
+ relativePaths.forEach(function (key) {
+ self.config[key] = path.resolve(self.root, self.config[key])
+ })
+
+ //if `include` isn't empty, we can return immediately and start generating docs.
+ //otherwise if it's empty we have to read the directory to get files to document.
+ if (self.config.include.length)
+ return cb(null)
+ }
- //assign default config settings by discovering files to document
+ //read the directory to find directories to document
//build default hash of paths to ignore - everything else gets documented
var ignore = {}
View
51 lib/generateDocs.js
@@ -1,6 +1,7 @@
var fs = require('fs')
, path = require('path')
, findit = require('findit')
+ , Seq = require('seq')
/**
* Traverse down the root and run .renderDoc() as files are discovered.
@@ -11,24 +12,26 @@ module.exports = function generateDocs (cb) {
var self = this
, done = 0
- //if we have one file to write to, this flag tells us
- //that we have initialized the file (with css) so we don't
- //do that multiple times
- this.wroteCss = false
-
- //create dir to put docs in
- this.makeDocDirectory(function (err) {
- if (err) return cb(err)
+ Seq()
+ //initialize doc file with css (and cache template on writeme instance)
+ .seq(function () {
+ self.initializeDoc(this)
+ })
+ //make doc directory
+ .seq(function () {
+ self.makeDocDirectory(this)
+ })
+ .seq(function () {
+ //push files as we discover them - we want to keep the ordering
+ var files = []
- //traverse each of our `include` paths - document+render all .js files
- //call @cb when we are done traversing
- self.config.include.forEach(function (target) {
- var where = path.resolve(self.root, target)
+ //traverse each of our `include` paths - document+render all .js files
+ //call @cb when we are done traversing
+ self.config.include.forEach(function (target) {
+ var where = path.resolve(self.root, target)
- //check to make sure the `include` exists on the fs
- //warn user if it doesn't exist on the fs, and return early
- fs.exists(where, function (exists) {
- if (!exists) {
+ //if this `include` path doesn't exist, return early
+ if (!fs.existsSync(where)) {
var msg = 'warning: writeme config has invalid path in `include` array: '+where
console.log(msg.red)
return
@@ -37,20 +40,20 @@ module.exports = function generateDocs (cb) {
//this `include` path exists. Traverse it
var finder = findit.find(where)
- //make sure renderDoc() is bound to our writeme instance
- var boundRenderDoc = self.renderDoc.bind(self)
-
//grab all the files in the `include` path. If it points to a file, then `file`
//will be emitted once with the name of the file.
- finder.on('file', boundRenderDoc)
+ finder.on('file', function (file, stat) {
+ if (path.extname(file) === '.js')
+ files.push(file)
+ })
finder.on('end', function () {
done += 1
- //call @cb when all finders are done
- if (done === self.config.include.length)
- return cb(null)
+ //render docs when all `include` paths have been traversed
+ if (done === self.config.include.length) {
+ self.renderDocs(files)
+ }
})
})
})
- })
}
View
49 lib/initializeDoc.js
@@ -0,0 +1,49 @@
+var fs = require('fs'),
+ Seq = require('seq')
+
+/**
+ * initialize doc (write css) and cache config.template_path
+ *
+ * @param {Function} cb completion callback. Signature: function (err)
+ */
+module.exports = function initializeDoc (cb) {
+ var self = this
+ , absHtmlPath = this.config.doc_base+'.html'
+ , absMdPath = this.config.doc_base+'.md'
+
+ Seq()
+ //grab css from config.css_path
+ .seq(function () {
+ var seqSelf = this
+ fs.readFile(self.config.css_path, 'utf8', function (err, css) {
+ if (err) return cb(err)
+
+ return seqSelf(null, css)
+ })
+ })
+ .par(function () {
+ var parSelf = this
+ fs.exists(absMdPath, function (exists) {
+ if (exists)
+ return fs.unlink(absMdPath, parSelf)
+
+ return parSelf(null)
+ })
+ })
+ //write css to html file
+ .par(function (css) {
+ var styleNode = '<style>\n'+css+'\n</style>\n'
+ return fs.writeFile(absHtmlPath, styleNode, this)
+ })
+ //get template file contents and cache them
+ .seq(function () {
+ var parSelf = this
+
+ fs.readFile(self.config.template_path, 'utf8', function (err, contents) {
+ if (err) return cb(err)
+
+ self.cachedTemplate = contents
+ return cb(null)
+ })
+ })
+}
View
8 lib/makeDocDirectory.js
@@ -9,16 +9,16 @@ var fs = require('fs')
module.exports = function makeDocDirectory (cb) {
var self = this
//make docs directory to put output in
- this.docPath = this.config.doc_dir
+ var docDir = path.dirname(this.config.doc_base)
//check if docPath already exists, create it if doesn't already exist
- fs.exists(this.docPath, function (exists) {
+ fs.exists(docDir, function (exists) {
if (exists) return cb(null)
//docs directory does not exist, so create it
- fs.mkdir(self.docPath, function (err) {
+ fs.mkdir(docDir, function (err) {
if (err) {
- var msg = 'writeme failed to create doc directory at: '+self.docPath+': '+err
+ var msg = 'writeme failed to create doc directory at: '+docDir+': '+err
var error = new Error(msg)
return cb(error)
}
View
134 lib/renderDoc.js
@@ -1,134 +0,0 @@
-var cp = require('child_process')
- , fs = require('fs')
- , path = require('path')
- , util = require('util')
- , mustache = require('mustache')
- , Seq = require('seq')
-
-/**
- * Run `dox` on @file, render markdown & html, then save in docs directory
- *
- * @param {string} file absolute file path to document
- * @param {object} stat file's stats
- */
-module.exports = function renderDoc (file, stat) {
- if (path.extname(file) !== '.js')
- return
-
- var self = this
- , docBase = null
-
- //determine file basename to write our document to
- //if our config set the output filename, then write to that
- if (this.config.output)
- docBase = path.resolve(this.docPath, this.config.output)
- else
- docBase = path.resolve(this.docPath, path.basename(file, '.js'))
-
- //absolute paths to doc files
- var absHtmlPath = docBase+'.html'
- , absMdPath = docBase+'.md'
-
- Seq()
- //get css (cache if not already cached)
- .seq(function () {
- if (self.cachedCss)
- return this(null, self.cachedCss)
-
- var seqSelf = this
-
- //we haven't cached the css, so fetch and cache it
- fs.readFile(self.config.css_path, 'utf8', function (err, contents) {
- if (err) throw err
-
- self.cachedCss = contents
- return seqSelf(null, self.cachedCss)
- })
- })
- //write html file with css styling
- .par(function (css) {
- if (self.wroteCss)
- return this(null)
-
-
- if (self.config.output)
- self.wroteCss = true
-
- var styleNode = '<style>\n'+css+'\n</style>\n'
- return fs.writeFile(absHtmlPath, styleNode, this)
- })
- //get template file contents (cache if not already cached)
- .par(function () {
- if (self.cachedTemplate)
- return this(null, self.cachedTemplate)
-
- var parSelf = this
-
- fs.readFile(self.config.template_path, 'utf8', function (err, contents) {
- if (err) throw err
-
- self.cachedTemplate = contents
- return parSelf(null, self.cachedTemplate)
- })
- })
- //run dox on source file
- .par(function () {
- var parSelf = this
- //run dox on this file and call .renderDoc() on it after
- var doxExecPath = path.resolve(__dirname, '../node_modules/dox/bin/dox')
- var doxCommand = doxExecPath+' < '+file
-
- //run dox, pass stdout to seq
- cp.exec(doxCommand, function (err, stdout, stderr) {
- if (err) throw err
- if (stderr) return console.log('dox stderr:'.red, stderr)
-
- var doxOut = null
-
- try {
- doxOut = JSON.parse(stdout)
- } catch (err) {
- var error = new Error('dox did not generate valid json for filename '+filename)
- throw error
- }
-
- return parSelf(null, doxOut)
- })
- })
- //render dox output into template and write markdown doc file
- .seq(function (doxOut) {
- var seqSelf = this
-
- var template = this.args[1][0]
- , doxOut = this.args[2][0]
-
- var templateParams = {
- dirname: path.basename(self.root)
- , filename: path.relative(self.root, file)
- , doxOut: doxOut
- }
-
- //render the template using mustache
- var rendered = mustache.render(self.cachedTemplate, templateParams)
-
- //write populated markdown to file
- fs.writeFile(absMdPath, rendered, function (err) {
- if (err) throw err
-
- return seqSelf(null)
- })
- })
- //run `marked` on markdown output and append rendered html to html doc file
- .seq(function () {
- //now use marked to render the html version of the doc
- var markedPath = path.resolve(__dirname, '../node_modules/marked/bin/marked')
-
- var markedCommand = markedPath+' -i '+absMdPath+' >> '+absHtmlPath
-
- cp.exec(markedCommand, function (err, stdout, stderr) {
- if (err) throw err
- if (stderr) return console.log('marked stderr:'.red, stderr)
- if (stdout) return console.log('marked stdout:'.blue, stdout)
- })
- })
-}
View
86 lib/renderDocs.js
@@ -0,0 +1,86 @@
+var cp = require('child_process')
+ , fs = require('fs')
+ , path = require('path')
+ , util = require('util')
+ , mustache = require('mustache')
+ , Seq = require('seq')
+ , Showdown = require('showdown')
+
+/**
+ * Run `dox` on @file, render markdown & html, then write to doc files
+ *
+ * @param {array} files array of absolute paths of files to document
+ */
+module.exports = function renderDocs (files) {
+ var self = this
+
+ //absolute paths to doc files
+ var absHtmlPath = this.config.doc_base+'.html'
+ , absMdPath = this.config.doc_base+'.md'
+
+ Seq()
+ .seq(function () {
+ this(null, files)
+ })
+ .flatten()
+ //run dox on files in parallel
+ .parMap(function (file, i) {
+ console.log(('rendering doc for '+file).green)
+
+ var seqThis = this
+ //run dox on this file and call .renderDoc() on it after
+ var doxExecPath = path.resolve(__dirname, '../node_modules/dox/bin/dox')
+ var doxCommand = doxExecPath+' < '+file
+
+ //run dox, pass stdout to seq
+ cp.exec(doxCommand, function (err, stdout, stderr) {
+ if (err) throw err
+ if (stderr) return console.log('dox stderr:'.red, stderr)
+
+ var doxOut = null
+
+ try {
+ doxOutput = JSON.parse(stdout)
+ } catch (err) {
+ var error = new Error('dox did not generate valid json for filename '+filename)
+ throw error
+ }
+
+ var entry = {
+ filename: path.relative(self.root, file)
+ , doxOutput: doxOutput
+ }
+
+ return seqThis.into(i)(null, entry)
+ })
+ })
+ .unflatten()
+ //render dox output into template and write markdown doc file
+ .seq(function (doxArray) {
+ var seqThis = this
+ var template = self.cachedTemplate
+
+ var templateParams = {
+ dirname: path.basename(self.root)
+ , doxArray: doxArray
+ }
+
+ console.log('templateParams', util.inspect(templateParams, true, null, true))
+
+ //render the template using mustache
+ var markdown = mustache.render(self.cachedTemplate, templateParams)
+
+ this(null, markdown)
+ })
+ //write markdown file
+ .par(function (markdown) {
+ fs.writeFile(absMdPath, markdown, this)
+ })
+ //write html file
+ .par(function (markdown) {
+ var converter = new Showdown.converter()
+ var html = converter.makeHtml(markdown)
+
+ fs.appendFile(absHtmlPath, html, this)
+ })
+}
View
14 writeme.js → lib/writeme.js
@@ -29,12 +29,12 @@ function Writeme (root) {
/*
Attach prototype methods from lib directory
*/
- fs
- .readdirSync(path.resolve(__dirname, 'lib'))
- .forEach(function (file) {
- //add methods to prototype
- var method = path.basename(file, '.js')
- Writeme.prototype[method] = require('./lib/'+method)
- })
+Writeme.prototype = {
+ buildConfig: require('./buildConfig')
+ , generateDocs: require('./generateDocs')
+ , initializeDoc: require('./initializeDoc')
+ , makeDocDirectory: require('./makeDocDirectory')
+ , renderDocs: require('./renderDocs')
+}
module.exports = Writeme
View
7 node_modules/showdown/.gitattributes
@@ -0,0 +1,7 @@
+/test export-ignore
+.gitattributes export-ignore
+.gitignore export-ignore
+/perlMarkdown export-ignore
+/example export-ignore
+grunt.js export-ignore
+
View
3  node_modules/showdown/.npmignore
@@ -0,0 +1,3 @@
+.DS_Store
+node_modules
+npm-debug.log
View
4 node_modules/showdown/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.8
View
327 node_modules/showdown/README.md
@@ -0,0 +1,327 @@
+# Showdown [![build status](https://secure.travis-ci.org/coreyti/showdown.png)](http://travis-ci.org/coreyti/showdown)
+
+A JavaScript port of Markdown
+
+## Note
+
+ > **Please note** that I, [Corey](https://github.com/coreyti), am not the author
+ > of Showdown. Rather, I found it some time back at <http://attacklab.net/showdown/>
+ > (website removed, see: <http://wayback.archive.org/web/*/http://attacklab.net/showdown>)
+ > and wanted to see it available on GitHub.
+ >
+ > All credit and praise for authoring this library should go to John Fraser.
+ >
+ > Oh, and John Gruber of course.
+ >
+ > That said, Showdown *is* evolving. See below for a list of contributors and an
+ > overview of their contributions to the project.
+ >
+ > Apologies for any confusion or perceived misinformation.
+ >
+ > Cheers,<br/>
+ > Corey
+
+
+## Original Attributions
+
+Showdown Copyright (c) 2007 John Fraser.
+<http://www.attacklab.net/>
+
+Original Markdown Copyright (c) 2004-2005 John Gruber
+<http://daringfireball.net/projects/markdown/>
+
+Redistributable under a BSD-style open source license.
+See license.txt for more information.
+
+## Quick Example
+
+```js
+var Showdown = require('showdown');
+var converter = new Showdown.converter();
+
+converter.makeHtml('#hello markdown!');
+
+// <h1 id="hellomarkdown">hello, markdown</h1>
+```
+
+## What's it for?
+
+Developers can use Showdown to:
+
+ * Add in-browser preview to existing Markdown apps
+
+ Showdown's output is (almost always) identical to
+ markdown.pl's, so the server can reproduce exactly
+ the output that the user saw. (See below for
+ exceptions.)
+
+ * Add Markdown input to programs that don't support it
+
+ Any app that accepts HTML input can now be made to speak
+ Markdown by modifying the input pages's HTML. If your
+ application lets users edit documents again later,
+ then they won't have access to the original Markdown
+ text. But this should be good enough for many
+ uses -- and you can do it with just a two-line
+ `onsubmit` function!
+
+ * Add Markdown input to closed-source web apps
+
+ You can write bookmarklets or userscripts to extend
+ any standard textarea on the web so that it accepts
+ Markdown instead of HTML. With a little more hacking,
+ the same can probably be done with many rich edit
+ controls.
+
+ * Build new web apps from scratch
+
+ A Showdown front-end can send back text in Markdown,
+ HTML or both, so you can trade bandwidth for server
+ load to reduce your cost of operation. If your app
+ requires JavaScript, you won't need to do any
+ Markdown processing on the server at all. (For most
+ uses, you'll still need to sanitize the HTML before
+ showing it to other users -- but you'd need to do
+ that anyway if you're allowing raw HTML in your
+ Markdown.)
+
+
+## Browser Compatibility
+
+Showdown has been tested successfully with:
+
+ * Firefox 1.5 and 2.0
+ * Internet Explorer 6 and 7
+ * Safari 2.0.4
+ * Opera 8.54 and 9.10
+ * Netscape 8.1.2
+ * Konqueror 3.5.4
+
+In theory, Showdown will work in any browser that supports ECMA 262 3rd Edition (JavaScript 1.5). The converter itself might even work in things that aren't web browsers, like Acrobat. No promises.
+
+
+## Extensions
+
+Showdown allows additional functionality to be loaded via extensions.
+
+### Client-side Extension Usage
+
+```js
+<script src="src/showdown.js" />
+<script src="src/extensions/twitter.js" />
+
+var converter = new Showdown.converter({ extensions: 'twitter' });
+```
+
+### Server-side Extension Usage
+
+```js
+// Using a bundled extension
+var Showdown = require('showdown');
+var converter = new Showdown.converter({ extensions: ['twitter'] });
+
+// Using a custom extension
+var mine = require('./custom-extensions/mine');
+var converter = new Showdown.converter({ extensions: ['twitter', mine] });
+```
+
+
+## Known Differences in Output
+
+In most cases, Showdown's output is identical to that of Perl Markdown v1.0.2b7. What follows is a list of all known deviations. Please file an issue if you find more.
+
+ * This release uses the HTML parser from Markdown 1.0.2b2,
+ which means it fails `Inline HTML (Advanced).text` from
+ the Markdown test suite:
+
+ <div>
+ <div>
+ unindented == broken
+ </div>
+ </div>
+
+ * Showdown doesn't support the markdown="1" attribute:
+
+ <div markdown="1">
+ Markdown does *not* work in here.
+ </div>
+
+ This is half laziness on my part and half stubbornness.
+ Markdown is smart enough to process the contents of span-
+ level tags without screwing things up; shouldn't it be
+ able to do the same inside block elements? Let's find a
+ way to make markdown="1" the default.
+
+
+ * You can only nest square brackets in link titles to a
+ depth of two levels:
+
+ [[fine]](http://www.attacklab.net/)
+ [[[broken]]](http://www.attacklab.net/)
+
+ If you need more, you can escape them with backslashes.
+
+
+ * When sublists have paragraphs, Showdown produces equivalent
+ HTML with a slightly different arrangement of newlines:
+
+ + item
+
+ - subitem
+
+ The HTML has a superfluous newline before this
+ paragraph.
+
+ - subitem
+
+ The HTML here is unchanged.
+
+ - subitem
+
+ The HTML is missing a newline after this
+ list subitem.
+
+
+
+ * Markdown.pl creates empty title attributes for
+ inline-style images:
+
+ Here's an empty title on an inline-style
+ ![image](http://w3.org/Icons/valid-xhtml10).
+
+ I tried to replicate this to clean up my diffs during
+ testing, but I went too far: now Showdown also makes
+ empty titles for reference-style images:
+
+ Showdown makes an empty title for
+ reference-style ![images][] too.
+
+ [images]: http://w3.org/Icons/valid-xhtml10
+
+
+ * With crazy input, Markdown will mistakenly put
+ `<strong>` or `<em>` tags in URLs:
+
+ <a href="<*Markdown adds em tags in here*>">
+ improbable URL
+ </a>
+
+ Showdown won't. But still, don't do that.
+
+
+## Tests
+
+A suite of tests is available which require node.js. Once node is installed, run the following command from the project root to install the development dependencies:
+
+ npm install --dev
+
+Once installed the tests can be run from the project root using:
+
+ npm test
+
+New test cases can easily be added. Create a markdown file (ending in `.md`) which contains the markdown to test. Create a `.html` file of the exact same name. It will automatically be tested when the tests are executed with `mocha`.
+
+
+## Creating Markdown Extensions
+
+A showdown extension is simply a function which returns an array of extensions. Each single extension can be one of two types:
+
+ * Language Extension -- Language extensions are ones that that add new markdown syntax to showdown. For example, say you wanted `^^youtube http://www.youtube.com/watch?v=oHg5SJYRHA0` to automatically render as an embedded YouTube video, that would be a language extension.
+ * Output Modifiers -- After showdown has run, and generated HTML, an output modifier would change that HTML. For example, say you wanted to change `<div class="header">` to be `<header>`, that would be an output modifier.
+
+Each extension can provide two combinations of interfaces for showdown.
+
+### Regex/Replace
+
+Regex/replace style extensions are very similar to javascripts `string.replace` function. Two properties are given, `regex` and `replace`. `regex` is a string and `replace` can be either a string or a function. If `replace` is a string, it can use the `$1` syntax for group substitution, exactly as if it were making use of `string.replace` (internally it does this actually); The value of `regex` is assumed to be a global replacement.
+
+**Example:**
+
+```js
+var demo = function(converter) {
+ return [
+ // Replace escaped @ symbols
+ { type: 'lang', regex: '\\@', replace: '@' }
+ ];
+}
+```
+
+### Filter
+
+Alternately, if you'd just like to do everything yourself, you can specify a filter which is a callback with a single input parameter, text (the current source text within the showdown engine).
+
+**Example:**
+
+```js
+var demo = function(converter) {
+ return [
+ // Replace escaped @ symbols
+ { type: 'lang', function(text) {
+ return text.replace(/\\@/g, '@');
+ }}
+ ];
+}
+```
+
+### Implementation Concerns
+
+One bit which should be taken into account is maintaining both client-side and server-side compatibility. This can be achieved with a few lines of boilerplate code. First, to prevent polluting the global scope for client-side code, the extension definition should be wrapped in a self-executing function.
+
+```js
+(function(){
+ // Your extension here
+}());
+```
+
+Second, client-side extensions should add a property onto `Showdown.extensions` which matches the name of the file. As an example, a file named `demo.js` should then add `Showdown.extensions.demo`. Server-side extensions can simply export themselves.
+
+```js
+(function(){
+ var demo = function(converter) {
+ // ... extension code here ...
+ };
+
+ // Client-side export
+ if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { window.Showdown.extensions.demo = demo; }
+ // Server-side export
+ if (typeof module !== 'undefined') module.exports = demo;
+}());
+```
+
+### Testing Extensions
+
+The showdown test runner is setup to automatically test cases for extensions. To add test cases for an extension, create a new folder under `./test/extensions` which matches the name of the `.js` file in `./src/extensions`. Place any test cases into the filder using the md/html format and they will automatically be run when tests are run.
+
+
+## Credits
+
+ * Origins
+ * [John Fraser](http://attacklab.net/):<br/>
+ Author of Showdown
+ * [John Gruber](http://daringfireball.net/projects/markdown/):<br/>
+ Author of Markdown
+ * Maintenance/Contributions (roughly chronologically)
+ * [Corey Innis](http://github.com/coreyti):<br/>
+ GitHub project maintainer
+ * [Remy Sharp](https://github.com/remy/):<br/>
+ CommonJS-compatibility and more
+ * [Konstantin Käfer](https://github.com/kkaefer/):<br/>
+ CommonJS packaging
+ * [Roger Braun](https://github.com/rogerbraun):<br/>
+ Github-style code blocks
+ * [Dominic Tarr](https://github.com/dominictarr):<br/>
+ Documentation
+ * [Cat Chen](https://github.com/CatChen):<br/>
+ Export fix
+ * [Titus Stone](https://github.com/tstone):<br/>
+ Mocha tests, extension mechanism, and bug fixes
+ * [Rob Sutherland](https://github.com/roberocity):<br/>
+ The idea that lead to extensions
+ * [Pavel Lang](https://github.com/langpavel):<br/>
+ Code cleanup
+ * [Ben Combee](https://github.com/unwiredben):<br/>
+ Regex optimization
+ * [Adam Backstrom](https://github.com/abackstrom):<br/>
+ WebKit bugfix
+ * [Pascal Deschênes](https://github.com/pdeschen):<br/>
+ Grunt support, extension fixes + additions, packaging improvements, documentation
View
5 node_modules/showdown/compressed/extensions/github.js
@@ -0,0 +1,5 @@
+//
+// Github Extension (WIP)
+// ~~strike-through~~ -> <del>strike-through</del>
+//
+(function(){var a=function(a){return[{type:"lang",regex:"(~T){2}([^~]+)(~T){2}",replace:function(a,b,c,d){return"<del>"+c+"</del>"}}]};typeof window!="undefined"&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.github=a),typeof module!="undefined"&&(module.exports=a)})();
View
6 node_modules/showdown/compressed/extensions/google-prettify.js
@@ -0,0 +1,6 @@
+//
+// Google Prettify
+// A showdown extension to add Google Prettify (http://code.google.com/p/google-code-prettify/)
+// hints to showdown's HTML output.
+//
+(function(){var a=function(a){return[{type:"output",filter:function(a){return a.replace(/(<pre>)?<code>/gi,function(a,b){return b?'<pre class="prettyprint linenums" tabIndex="0"><code data-inner="1">':'<code class="prettyprint">'})}}]};typeof window!="undefined"&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.googlePrettify=a),typeof module!="undefined"&&(module.exports=a)})();
View
6 node_modules/showdown/compressed/extensions/twitter.js
@@ -0,0 +1,6 @@
+//
+// Twitter Extension
+// @username -> <a href="http://twitter.com/username">@username</a>
+// #hashtag -> <a href="http://twitter.com/search/%23hashtag">#hashtag</a>
+//
+(function(){var a=function(a){return[{type:"lang",regex:"\\B(\\\\)?@([\\S]+)\\b",replace:function(a,b,c){return b==="\\"?a:'<a href="http://twitter.com/'+c+'">@'+c+"</a>"}},{type:"lang",regex:"\\B(\\\\)?#([\\S]+)\\b",replace:function(a,b,c){return b==="\\"?a:'<a href="http://twitter.com/search/%23'+c+'">#'+c+"</a>"}},{type:"lang",regex:"\\\\@",replace:"@"}]};typeof window!="undefined"&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.twitter=a),typeof module!="undefined"&&(module.exports=a)})();
View
62 node_modules/showdown/compressed/showdown.js
@@ -0,0 +1,62 @@
+//
+// showdown.js -- A javascript port of Markdown.
+//
+// Copyright (c) 2007 John Fraser.
+//
+// Original Markdown Copyright (c) 2004-2005 John Gruber
+// <http://daringfireball.net/projects/markdown/>
+//
+// Redistributable under a BSD-style open source license.
+// See license.txt for more information.
+//
+// The full source distribution is at:
+//
+// A A L
+// T C A
+// T K B
+//
+// <http://www.attacklab.net/>
+//
+//
+// Wherever possible, Showdown is a straight, line-by-line port
+// of the Perl version of Markdown.
+//
+// This is not a normal parser design; it's basically just a
+// series of string substitutions. It's hard to read and
+// maintain this way, but keeping Showdown close to the original
+// design makes it easier to port new features.
+//
+// More importantly, Showdown behaves like markdown.pl in most
+// edge cases. So web applications can do client-side preview
+// in Javascript, and then build identical HTML on the server.
+//
+// This port needs the new RegExp functionality of ECMA 262,
+// 3rd Edition (i.e. Javascript 1.5). Most modern web browsers
+// should do fine. Even with the new regular expression features,
+// We do a lot of work to emulate Perl's regex functionality.
+// The tricky changes in this file mostly have the "attacklab:"
+// label. Major or self-explanatory changes don't.
+//
+// Smart diff tools like Araxis Merge will be able to match up
+// this file with markdown.pl in a useful way. A little tweaking
+// helps: in a copy of markdown.pl, replace "#" with "//" and
+// replace "$text" with "text". Be sure to ignore whitespace
+// and line endings.
+//
+//
+// Showdown usage:
+//
+// var text = "Markdown *rocks*.";
+//
+// var converter = new Showdown.converter();
+// var html = converter.makeHtml(text);
+//
+// alert(html);
+//
+// Note: move the sample code to the bottom of this
+// file before uncommenting it.
+//
+//
+// Showdown namespace
+//
+var Showdown={extensions:{}},forEach=Showdown.forEach=function(a,b){if(typeof a.forEach=="function")a.forEach(b);else{var c,d=a.length;for(c=0;c<d;c++)b(a[c],c,a)}},stdExtName=function(a){return a.replace(/[_-]||\s/g,"").toLowerCase()};Showdown.converter=function(a){var b,c,d,e=0,f=[],g=[];if(typeof module!="undefind"&&typeof exports!="undefined"&&typeof require!="undefind"){var h=require("fs");if(h){var i=h.readdirSync((__dirname||".")+"/extensions").filter(function(a){return~a.indexOf(".js")}).map(function(a){return a.replace(/\.js$/,"")});Showdown.forEach(i,function(a){var b=stdExtName(a);Showdown.extensions[b]=require("./extensions/"+a)})}}a&&a.extensions&&Showdown.forEach(a.extensions,function(a){typeof a=="string"&&(a=Showdown.extensions[stdExtName(a)]);if(typeof a!="function")throw"Extension '"+a+"' could not be loaded. It was either not found or is not a valid extension.";Showdown.forEach(a(this),function(a){a.type?a.type==="language"||a.type==="lang"?f.push(a):(a.type==="output"||a.type==="html")&&g.push(a):g.push(a)})}),this.makeHtml=function(a){return b={},c={},d=[],a=a.replace(/~/g,"~T"),a=a.replace(/\$/g,"~D"),a=a.replace(/\r\n/g,"\n"),a=a.replace(/\r/g,"\n"),a="\n\n"+a+"\n\n",a=L(a),a=a.replace(/^[ \t]+$/mg,""),Showdown.forEach(f,function(b){a=j(b,a)}),a=y(a),a=l(a),a=k(a),a=n(a),a=J(a),a=a.replace(/~D/g,"$$"),a=a.replace(/~T/g,"~"),Showdown.forEach(g,function(b){a=j(b,a)}),a};var j=function(a,b){if(a.regex){var c=new RegExp(a.regex,"g");return b.replace(c,a.replace)}if(a.filter)return a.filter(b)},k=function(a){return a+="~0",a=a.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm,function(a,d,e,f,g){return d=d.toLowerCase(),b[d]=F(e),f?f+g:(g&&(c[d]=g.replace(/"/g,"&quot;")),"")}),a=a.replace(/~0/,""),a},l=function(a){a=a.replace(/\n/g,"\n\n");var b="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del|style|section|header|footer|nav|article|aside",c="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside";return a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,m),a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,m),a=a.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,m),a=a.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,m),a=a.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,m),a=a.replace(/\n\n/g,"\n"),a},m=function(a,b){var c=b;return c=c.replace(/\n\n/g,"\n"),c=c.replace(/^\n/,""),c=c.replace(/\n+$/g,""),c="\n\n~K"+(d.push(c)-1)+"K\n\n",c},n=function(a){a=u(a);var b=z("<hr />");return a=a.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,b),a=w(a),a=x(a),a=D(a),a=l(a),a=E(a),a},o=function(a){return a=A(a),a=p(a),a=G(a),a=s(a),a=q(a),a=H(a),a=F(a),a=C(a),a=a.replace(/ +\n/g," <br />\n"),a},p=function(a){var b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;return a=a.replace(b,function(a){var b=a.replace(/(.)<\/?code>(?=.)/g,"$1`");return b=M(b,"\\`*_"),b}),a},q=function(a){return a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,r),a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,r),a=a.replace(/(\[([^\[\]]+)\])()()()()()/g,r),a},r=function(a,d,e,f,g,h,i,j){j==undefined&&(j="");var k=d,l=e,m=f.toLowerCase(),n=g,o=j;if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(b[m]!=undefined)n=b[m],c[m]!=undefined&&(o=c[m]);else{if(!(k.search(/\(\s*\)$/m)>-1))return k;n=""}}n=M(n,"*_");var p='<a href="'+n+'"';return o!=""&&(o=o.replace(/"/g,"&quot;"),o=M(o,"*_"),p+=' title="'+o+'"'),p+=">"+l+"</a>",p},s=function(a){return a=a.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,t),a=a.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,t),a},t=function(a,d,e,f,g,h,i,j){var k=d,l=e,m=f.toLowerCase(),n=g,o=j;o||(o="");if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(b[m]==undefined)return k;n=b[m],c[m]!=undefined&&(o=c[m])}l=l.replace(/"/g,"&quot;"),n=M(n,"*_");var p='<img src="'+n+'" alt="'+l+'"';return o=o.replace(/"/g,"&quot;"),o=M(o,"*_"),p+=' title="'+o+'"',p+=" />",p},u=function(a){function b(a){return a.replace(/[^\w]/g,"").toLowerCase()}return a=a.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(a,c){return z('<h1 id="'+b(c)+'">'+o(c)+"</h1>")}),a=a.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(a,c){return z('<h2 id="'+b(c)+'">'+o(c)+"</h2>")}),a=a.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(a,c,d){var e=c.length;return z("<h"+e+' id="'+b(d)+'">'+o(d)+"</h"+e+">")}),a},v,w=function(a){a+="~0";var b=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return e?a=a.replace(b,function(a,b,c){var d=b,e=c.search(/[*+-]/g)>-1?"ul":"ol";d=d.replace(/\n{2,}/g,"\n\n\n");var f=v(d);return f=f.replace(/\s+$/,""),f="<"+e+">"+f+"</"+e+">\n",f}):(b=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,a=a.replace(b,function(a,b,c,d){var e=b,f=c,g=d.search(/[*+-]/g)>-1?"ul":"ol",f=f.replace(/\n{2,}/g,"\n\n\n"),h=v(f);return h=e+"<"+g+">\n"+h+"</"+g+">\n",h})),a=a.replace(/~0/,""),a};v=function(a){return e++,a=a.replace(/\n{2,}$/,"\n"),a+="~0",a=a.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(a,b,c,d,e){var f=e,g=b,h=c;return g||f.search(/\n{2,}/)>-1?f=n(K(f)):(f=w(K(f)),f=f.replace(/\n$/,""),f=o(f)),"<li>"+f+"</li>\n"}),a=a.replace(/~0/g,""),e--,a};var x=function(a){return a+="~0",a=a.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(a,b,c){var d=b,e=c;return d=B(K(d)),d=L(d),d=d.replace(/^\n+/g,""),d=d.replace(/\n+$/g,""),d="<pre><code>"+d+"\n</code></pre>",z(d)+e}),a=a.replace(/~0/,""),a},y=function(a){return a+="~0",a=a.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(a,b,c){var d=b,e=c;return e=B(e),e=L(e),e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,""),e="<pre><code"+(d?' class="'+d+'"':"")+">"+e+"\n</code></pre>",z(e)}),a=a.replace(/~0/,""),a},z=function(a){return a=a.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(d.push(a)-1)+"K\n\n"},A=function(a){return a=a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(a,b,c,d,e){var f=d;return f=f.replace(/^([ \t]*)/g,""),f=f.replace(/[ \t]*$/g,""),f=B(f),b+"<code>"+f+"</code>"}),a},B=function(a){return a=a.replace(/&/g,"&amp;"),a=a.replace(/</g,"&lt;"),a=a.replace(/>/g,"&gt;"),a=M(a,"*_{}[]\\",!1),a},C=function(a){return a=a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>"),a=a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>"),a},D=function(a){return a=a.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(a,b){var c=b;return c=c.replace(/^[ \t]*>[ \t]?/gm,"~0"),c=c.replace(/~0/g,""),c=c.replace(/^[ \t]+$/gm,""),c=n(c),c=c.replace(/(^|\n)/g,"$1 "),c=c.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(a,b){var c=b;return c=c.replace(/^ /mg,"~0"),c=c.replace(/~0/g,""),c}),z("<blockquote>\n"+c+"\n</blockquote>")}),a},E=function(a){a=a.replace(/^\n+/g,""),a=a.replace(/\n+$/g,"");var b=a.split(/\n{2,}/g),c=[],e=b.length;for(var f=0;f<e;f++){var g=b[f];g.search(/~K(\d+)K/g)>=0?c.push(g):g.search(/\S/)>=0&&(g=o(g),g=g.replace(/^([ \t]*)/g,"<p>"),g+="</p>",c.push(g))}e=c.length;for(var f=0;f<e;f++)while(c[f].search(/~K(\d+)K/)>=0){var h=d[RegExp.$1];h=h.replace(/\$/g,"$$$$"),c[f]=c[f].replace(/~K\d+K/,h)}return c.join("\n\n")},F=function(a){return a=a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;"),a=a.replace(/<(?![a-z\/?\$!])/gi,"&lt;"),a},G=function(a){return a=a.replace(/\\(\\)/g,N),a=a.replace(/\\([`*_{}\[\]()>#+-.!])/g,N),a},H=function(a){return a=a.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>'),a=a.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(a,b){return I(J(b))}),a},I=function(a){var b=[function(a){return"&#"+a.charCodeAt(0)+";"},function(a){return"&#x"+a.charCodeAt(0).toString(16)+";"},function(a){return a}];return a="mailto:"+a,a=a.replace(/./g,function(a){if(a=="@")a=b[Math.floor(Math.random()*2)](a);else if(a!=":"){var c=Math.random();a=c>.9?b[2](a):c>.45?b[1](a):b[0](a)}return a}),a='<a href="'+a+'">'+a+"</a>",a=a.replace(/">.+:/g,'">'),a},J=function(a){return a=a.replace(/~E(\d+)E/g,function(a,b){var c=parseInt(b);return String.fromCharCode(c)}),a},K=function(a){return a=a.replace(/^(\t|[ ]{1,4})/gm,"~0"),a=a.replace(/~0/g,""),a},L=function(a){return a=a.replace(/\t(?=\t)/g," "),a=a.replace(/\t/g,"~A~B"),a=a.replace(/~B(.+?)~A/g,function(a,b,c){var d=b,e=4-d.length%4;for(var f=0;f<e;f++)d+=" ";return d}),a=a.replace(/~A/g," "),a=a.replace(/~B/g,""),a},M=function(a,b,c){var d="(["+b.replace(/([\[\]\\])/g,"\\$1")+"])";c&&(d="\\\\"+d);var e=new RegExp(d,"g");return a=a.replace(e,N),a},N=function(a,b){var c=b.charCodeAt(0);return"~E"+c+"E"}},typeof module!="undefined"&&(module.exports=Showdown),typeof define=="function"&&define.amd&&define("showdown",function(){return Showdown});
View
720 node_modules/showdown/example/showdown-gui.html
@@ -0,0 +1,720 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>Showdown - Markdown in Javascript</title>
+ <script type="text/javascript" src="showdown.js"></script>
+ <script type="text/javascript" src="showdown-gui.js"></script>
+ <style type="text/css">
+ html,body {
+ margin:0;
+ padding:0;
+ font-family: Helvetica, Arial, Verdana, sans-serif;
+ font-size: 90%;
+ background-color: #e0d8d8;
+ }
+
+ html {
+ overflow: hidden;
+ }
+
+ textarea {
+ font-family: monospace;
+ }
+
+ #pageHeader {
+ margin: 0;
+ padding: 0;
+ text-align: center;
+ margin-bottom: 0;
+ margin-top: 0.4em;
+ color: #766;
+ }
+
+ #pageHeader h1 {
+ font-size: 3em;
+ }
+
+ #pageHeader * {
+ margin: 0;
+ padding: 0;
+ line-height: 1em;
+ font-weight: 100;
+ }
+
+ #pageHeader a {
+ color: #766;
+ text-decoration: none;
+ position: relative;
+ z-index: 20;
+ }
+
+ #pageHeader h1 a:hover {
+ color: #fff;
+ }
+
+ #pageHeader h4 a:hover {
+ text-decoration: underline;
+ }
+
+ #leftContainer, #rightContainer {
+ margin: 0;
+ padding: 0;
+ position: relative;
+ width: 47.5%;
+ margin-top: -1.4em;
+ }
+
+ #leftContainer {
+ float: left;
+ left: 1.5%;
+ }
+
+ #rightContainer {
+ float: right;
+ right: 1.5%;
+ }
+
+ #rightContainer > * {
+ float: right;
+ }
+
+ .paneHeader {
+ margin: 0;
+ padding: 0;
+ position: relative;
+ width: 100%;
+ display: block;
+ height: 2em;
+ }
+
+ .paneHeader * {
+ position: relative;
+ font-weight: 900;
+ }
+
+ .paneHeader span {
+ background-color: #ddd5d5;
+ color: #444;
+ padding: 0 0.75em;
+ font-size: 110%;
+ }
+
+ #paneSetting {
+ display: block;
+ margin-left: auto;
+ margin-right: 0.5em;
+ font-size: 110%;
+ font-weight: 900;
+ font-family: Arial, Verdana, sans-serif;
+ background-color: #dacccc;
+ color: #444;
+ border: 1px solid #999;
+ }
+
+ .pane {
+ margin: 0;
+ padding: 0;
+ padding-left: 4px; /* pane padding */
+ width: 100%;
+ border: none;