Skip to content

Commit

Permalink
add support for custom template files, add avanced example.
Browse files Browse the repository at this point in the history
  • Loading branch information
millermedeiros committed Nov 28, 2011
1 parent 7147a64 commit 0ff290b
Show file tree
Hide file tree
Showing 48 changed files with 3,014 additions and 37 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
examples/
54 changes: 33 additions & 21 deletions README.mdown
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
# mdoc - a simple markdown documentation generator

created mainly to document [amd-utils](http://millermedeiros.github.com/amd-utils).
This is a simple markdown based documentation generator, it will search all the
markdown files inside the "input" directory and output an HTML file for each
document, it will also generate a "TOC" (table of contents) for each file and
links to all the pages on the index page, it also provides a basic search
feature and quick browsing between classes/methods/properties.

not sure how far this project will go.
For a live example check [amd-utils documentation](http://millermedeiros.github.com/amd-utils).



## TODO
## Install

You can install it through [NPM](http://npmjs.org):

npm install mdoc

- load pages using Ajax (if protocol isn't "file:") and use the HTML5 History
API if available.
- create 2 different modes for documentation generation:
1. treat each mdown file as a separate page.
2. aggregate all the files inside a folder into a single page with the same
name, appending the content to file if it already exists.
- add all heading levels to the TOC of the pages and add option to control
till which heading level should be displayed on the document TOC. (only show
H2 items on the sidebar tho)
- convert stylesheets to stylus to allow easy color scheme generation.
- create another example which uses advanced settings (file/module
mapping/filtering).
- document options.
- add support for custom templates without needing to edit the "src/template"
folder.


## Example
Expand All @@ -31,15 +24,34 @@ Clone repository and run:

npm link

it will install dependencies and `link` mdoc. than:
This will install dependencies and `link` mdoc, than you can run:

cd examples/01
cd examples/basic
node build

Check output inside "examples/01/doc".
Check output inside "examples/basic/doc".

Check "examples/advanced" for all the available settings.



## License

Released under the MIT license.



## TODO

- load pages using Ajax (if protocol isn't "file:") and use the HTML5 History
API if available.
- create 2 different modes for documentation generation:
1. treat each mdown file as a separate page.
2. aggregate all the files inside a folder into a single page with the same
name, appending the content to file if it already exists.
- add all heading levels to the TOC of the pages and add option to control
till which heading level should be displayed on the document TOC. (only show
H2 items on the sidebar tho)
- convert stylesheets to stylus to allow easy color scheme generation.
- create a CLI and `bin` file since most of the times user only need to supply
input/output directories.
50 changes: 50 additions & 0 deletions examples/advanced/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// This file contains all available settings.
//

var mdoc = require('mdoc');

mdoc.run({

// === required settings === //

inputDir : '../basic/content',
outputDir : 'doc',


// === basic settings === //

baseTitle : 'mdoc example advanced settings',
//indexContenPath : '../basic/index.mdown',


// === advanced settings === //

templatePath : 'custom_template',

//indexContent will take precedence over `indexContentPath`
indexContent : '<h1>Custom Template</h1><p>Example of a custom template and advanced settings.</p>',

mapOutName : function(outputName) {
//change file output name
return outputName.replace('.html', '_doc.html');
},

mapTocName : function(fileName, tocObject){
//change the name displayed on the sidebar and on the index TOC
return fileName.replace('_doc.html', '');
},

// pattern that matches files that should be parsed
// this is the default value...
include : '*.mdown,*.md,*.markdown',

// pattern that matches files that shouldn't be parsed
exclude : 'array.*',

filterFiles : function(fileInfo) {
// return `false` to remove files and `true` to keep them
return (/math/).test(fileInfo.input);
}

});
Loading

0 comments on commit 0ff290b

Please sign in to comment.