diff --git a/Makefile b/Makefile index 81124821..d77ee684 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,8 @@ uninstall: rm -fr ~/.node_libraries/dox examples: uninstall install - dox --title "Dox Example" --desc "This is an example using _dox_, how **cool!**" \ - examples/*.js > examples/index.html && open examples/index.html + dox --title "Dox Example" \ + --desc "This is an example using _dox_, how **cool!**" \ + examples/*.js > examples/index.html .PHONY: install uninstall examples \ No newline at end of file diff --git a/examples/foo.js b/examples/foo.js index 4e4c0afd..9d29ea4a 100644 --- a/examples/foo.js +++ b/examples/foo.js @@ -21,16 +21,16 @@ var files = ['foo.js', 'bar.js']; /** * Output contents of _foo.js_ and _bar.js_. * - * # h1 - * ## h2 - * ### h3 - * - * ## WTF: + * ## Stuff: * * This is just a stupid random demo, so... here is a list: * - * - foo.js - * - bar.js + * - a + * * b + * * c + * - d + * - e + * - f * * ## Examples: * @@ -38,6 +38,10 @@ var files = ['foo.js', 'bar.js']; * * Just a [link](http://github.com/visionmedia/dox) to dox's _source_. * + * ## HTML + * + * Is escaped, for example :). + * * @param {String} nothing a string that does nothing * @return {Object} exports for chaining * @api public @@ -46,9 +50,11 @@ var files = ['foo.js', 'bar.js']; var output = exports.output = function(nothing){ for (var i = 0, len = files.length; i < len; ++i) { var file = files[i]; + // Just some stupid comment if (file.match(/\.js$/)) { fs.readFile(file, function(err, str){ if (err) { + // lalalalala throw err; } else { sys.puts(str); diff --git a/examples/index.html b/examples/index.html index a98ffd3f..5d792a83 100644 --- a/examples/index.html +++ b/examples/index.html @@ -15,7 +15,7 @@ text-decoration: underline; color: #19469D; } -h1 { +h1, h2, h3 { margin: 0; padding: 0; } @@ -78,6 +78,7 @@ table#source tr.filename { padding-top: 40px; border-top: 1px solid #E5E5EE; + text-transform: capitalize; } table#source tr.filename td:last-child { font-size: 12px; @@ -86,6 +87,27 @@ margin: 0; padding: 0; } +table#source tr.code h1, +table#source tr.code h2, +table#source tr.code h3 { + margin-top: 30px; + font-family: "Lucida Grande", "Helvetica Nueue", Arial, sans-serif; + font-size: 18px; +} +table#source tr.code h2 { + font-size: 16px; +} +table#source tr.code h3 { + font-size: 14px; +} +table#source tr.code ul { + margin: 5px 0 5px 35px; + padding: 0; +} +table#source tr.code ul li { + margin: 0; + padding: 2px 0; +} code .string { color: #219161; } code .regexp { color: #219161; } code .keyword { color: #954121; } @@ -96,21 +118,24 @@ +
  • examples/foo
  • Dox Example

    This is an example using _dox_, how **cool!**

    bar

    examples/bar.js
    - + - + - + - + - +'); - html.push(''); + html.push(''); + html.push(''); html.push(''); @@ -223,7 +221,7 @@ var render = exports.render = function(str){ function jsdocToMarkdown(str) { return str .replace(/^ *@(\w+) *\{([^}]+)\}( *[^\n]+)?/gm, function(_, key, type, desc){ - return '**' + key + '**: _' + type.split(/ *[|\/] */).join(' | ') + '_ ' + desc; + return '- **' + key + '**: _' + type.split(/ *[|\/] */).join(' | ') + '_ ' + desc; }) - .replace(/^ *@(\w+) *(\w+)/gm, '**$1**: _$2_'); + .replace(/^ *@(\w+) *(\w+)/gm, '- **$1**: _$2_'); } \ No newline at end of file diff --git a/lib/styles/default/style.css b/lib/styles/default/style.css index c1b3b720..cf2a348f 100644 --- a/lib/styles/default/style.css +++ b/lib/styles/default/style.css @@ -12,7 +12,7 @@ a:hover { text-decoration: underline; color: #19469D; } -h1 { +h1, h2, h3 { margin: 0; padding: 0; } @@ -75,6 +75,7 @@ table#source tr { table#source tr.filename { padding-top: 40px; border-top: 1px solid #E5E5EE; + text-transform: capitalize; } table#source tr.filename td:last-child { font-size: 12px; @@ -83,6 +84,27 @@ table#source tr.filename h2 { margin: 0; padding: 0; } +table#source tr.code h1, +table#source tr.code h2, +table#source tr.code h3 { + margin-top: 30px; + font-family: "Lucida Grande", "Helvetica Nueue", Arial, sans-serif; + font-size: 18px; +} +table#source tr.code h2 { + font-size: 16px; +} +table#source tr.code h3 { + font-size: 14px; +} +table#source tr.code ul { + margin: 5px 0 5px 35px; + padding: 0; +} +table#source tr.code ul li { + margin: 0; + padding: 2px 0; +} code .string { color: #219161; } code .regexp { color: #219161; } code .keyword { color: #954121; }

    Dox Example

    This is an example using _dox_, how **cool!**

    bar

    examples/bar.js
    -

    Module dependencies.

    +

    Module dependencies.

    var sys = require('sys');
    -

    Output foo and bar, seperated by +.

    +

    Output foo and bar, seperated by +.

    + +
      +
    • param: String foo
    • +
    • param: String bar
    • +
    • api: public
    • +
    -

    param: String foo -param: String bar -api: public

    function bar(foo, bar){
    @@ -118,47 +143,53 @@
     }
    -

    Export bar().

    +

    Export bar().

    exports.bar = bar;

    foo

    examples/foo.js

    foo

    examples/foo.js
    -

    Module dependencies.

    +

    Module dependencies.

    var sys = require('sys'),
         fs = require('fs');
    -

    Files used by exports.output();

    +

    Files used by exports.output();

    var files = ['foo.js', 'bar.js'];
    -

    Output contents of foo.js and bar.js.

    - -

    h1

    +

    Output contents of foo.js and bar.js.

    -

    h2

    +

    Stuff:

    -

    h3

    +

    This is just a stupid random demo, so… here is a list:

    -

    WTF:

    +
      +
    • a -

      This is just a stupid random demo, so… here is a list:

      +
        +
      • b
      • +
      • c
          -
        • foo.js
        • -
        • bar.js
        • +
        • d
        • +
        • e
        • +
        +
      • +
      +
    • +
    • f
    @@ -168,17 +199,26 @@

    Examples:

    Just a link to dox’s source.

    -

    param: String nothing a string that does nothing -return: Object exports for chaining -api: public

    +

    HTML

    + +

    Is escaped, for example :).

    + +
      +
    • param: String nothing a string that does nothing
    • +
    • return: Object exports for chaining
    • +
    • api: public
    • +
    +
    var output = exports.output = function(nothing){
         for (var i = 0, len = files.length; i < len; ++i) {
             var file = files[i];
    +        // Just some stupid comment
             if (file.match(/\.js$/)) {
                 fs.readFile(file, function(err, str){
                    if (err) {
    +                   // lalalalala
                        throw err;
                    } else {
                        sys.puts(str); 
    diff --git a/lib/index.js b/lib/index.js
    index 513c58a4..d0586c7a 100644
    --- a/lib/index.js
    +++ b/lib/index.js
    @@ -199,10 +199,8 @@ var render = exports.render = function(str){
         var html = [];
         for (var i = 0, len = blocks.length; i < len; ++i) {
             var block = blocks[i];
    -        html.push('
    ', block.comment - ? '
    ' + block.comment + '
    ' - : '', '
    ', block.comment || '', '', block.code ? '
    ' + block.code + '
    ' : '', '