mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Merge branch 'master' into parsimony
Conflicts: lib/jsdoc/src/filter.js lib/jsdoc/src/scanner.js package.json test/specs/jsdoc/src/filter.js test/specs/jsdoc/src/scanner.js test/specs/tags/exportstag.js
This commit is contained in:
commit
6651a85b35
@ -21,7 +21,6 @@
|
|||||||
"esprima": "1.0.4",
|
"esprima": "1.0.4",
|
||||||
"js2xmlparser": "0.1.0",
|
"js2xmlparser": "0.1.0",
|
||||||
"jshint": "0.9.1",
|
"jshint": "0.9.1",
|
||||||
"markdown": "git+https://github.com/jsdoc3/markdown-js.git",
|
|
||||||
"marked": "0.2.8",
|
"marked": "0.2.8",
|
||||||
"taffydb": "git+https://github.com/hegemonic/taffydb.git",
|
"taffydb": "git+https://github.com/hegemonic/taffydb.git",
|
||||||
"underscore": "1.4.2",
|
"underscore": "1.4.2",
|
||||||
|
|||||||
12
LICENSE.md
12
LICENSE.md
@ -244,18 +244,6 @@ The source code for JSHint is available at:
|
|||||||
https://github.com/jshint/jshint
|
https://github.com/jshint/jshint
|
||||||
|
|
||||||
|
|
||||||
## markdown-js ##
|
|
||||||
|
|
||||||
markdown-js is distributed under the MIT license, which is reproduced above.
|
|
||||||
|
|
||||||
Copyright (c) 2009-2010 Dominic Baggott. Copyright (c) 2009-2010 Ash Berlin.
|
|
||||||
Copyright (c) 2011 Christoph Dorn <christoph@christophdorn.com>
|
|
||||||
(http://www.christophdorn.com).
|
|
||||||
|
|
||||||
The source code for markdown-js is available at:
|
|
||||||
https://github.com/evilstreak/markdown-js
|
|
||||||
|
|
||||||
|
|
||||||
## Node.js ##
|
## Node.js ##
|
||||||
|
|
||||||
Portions of the Node.js source code are incorporated into the following files:
|
Portions of the Node.js source code are incorporated into the following files:
|
||||||
|
|||||||
11
changes.md
11
changes.md
@ -3,6 +3,17 @@
|
|||||||
This file describes notable changes in each version of JSDoc 3. To download a specific version of JSDoc 3, see [GitHub's tags page](https://github.com/jsdoc3/jsdoc/tags).
|
This file describes notable changes in each version of JSDoc 3. To download a specific version of JSDoc 3, see [GitHub's tags page](https://github.com/jsdoc3/jsdoc/tags).
|
||||||
|
|
||||||
|
|
||||||
|
## 3.2.2 (November 2013)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
+ Addressed a regression in JSDoc 3.2.1 that could prevent a function declaration from shadowing a declaration with the same name in an outer scope. (#513)
|
||||||
|
+ If a child class overrides a method in a parent class without documenting the overridden method, the method's documentation is now copied from the parent class. (#503)
|
||||||
|
+ You can now use inline HTML tags in Markdown-formatted text. In addition, JSDoc now uses only the [marked Markdown parser](https://github.com/chjj/marked); the markdown-js parser has been removed. (#510)
|
||||||
|
+ Type expressions can now include a much broader range of repeatable types. In addition, you can now use Closure Compiler's nullable and non-nullable modifiers with repeatable types. For example, the type expression `...!string` (a repeatable, non-nullable string) is now parsed correctly. (#502)
|
||||||
|
+ If a function accepts a parameter named `prototype`, the parameter is no longer renamed during parsing. (#505)
|
||||||
|
+ If the list of input files includes relative paths, the paths are now resolved relative to the user's working directory. (a3d33842)
|
||||||
|
|
||||||
|
|
||||||
## 3.2.1 (October 2013)
|
## 3.2.1 (October 2013)
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
|||||||
@ -10,6 +10,9 @@ SET _BASEPATH=%_BASEPATH:~0,-1%
|
|||||||
REM for whatever reason, Rhino requires module paths to be valid URIs
|
REM for whatever reason, Rhino requires module paths to be valid URIs
|
||||||
SET _URLPATH=file:/%_BASEPATH%
|
SET _URLPATH=file:/%_BASEPATH%
|
||||||
|
|
||||||
|
REM we need the ability to resolve paths relative to the user's pwd
|
||||||
|
SET PWD=%cd%
|
||||||
|
|
||||||
IF "%_URLPATH%"=="%_URLPATH: =%" GOTO NO_SPACES
|
IF "%_URLPATH%"=="%_URLPATH: =%" GOTO NO_SPACES
|
||||||
:ESCAPE_SPACE
|
:ESCAPE_SPACE
|
||||||
SET _TRAILING=%_URLPATH:* =%
|
SET _TRAILING=%_URLPATH:* =%
|
||||||
|
|||||||
@ -33,7 +33,7 @@ const defaults = {
|
|||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"includePattern": ".+\\.js(doc)?$",
|
"includePattern": ".+\\.js(doc)?$",
|
||||||
"excludePattern": "(^|\\/|\\\\)_"
|
"excludePattern": ""
|
||||||
},
|
},
|
||||||
"plugins": []
|
"plugins": []
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
/*global env: true */
|
|
||||||
/**
|
/**
|
||||||
@module jsdoc/src/filter
|
@module jsdoc/src/filter
|
||||||
|
|
||||||
@ -8,6 +7,8 @@
|
|||||||
|
|
||||||
var path = require('jsdoc/path');
|
var path = require('jsdoc/path');
|
||||||
|
|
||||||
|
var pwd = process.env.PWD;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@constructor
|
@constructor
|
||||||
@param {object} opts
|
@param {object} opts
|
||||||
@ -18,7 +19,7 @@ var path = require('jsdoc/path');
|
|||||||
exports.Filter = function(opts) {
|
exports.Filter = function(opts) {
|
||||||
this.exclude = opts.exclude && Array.isArray(opts.exclude) ?
|
this.exclude = opts.exclude && Array.isArray(opts.exclude) ?
|
||||||
opts.exclude.map(function($) {
|
opts.exclude.map(function($) {
|
||||||
return path.resolve(process.env.PWD, $);
|
return path.resolve(pwd, $);
|
||||||
}) :
|
}) :
|
||||||
null;
|
null;
|
||||||
this.includePattern = opts.includePattern?
|
this.includePattern = opts.includePattern?
|
||||||
@ -34,7 +35,7 @@ exports.Filter = function(opts) {
|
|||||||
@returns {boolean} Should the given file be included?
|
@returns {boolean} Should the given file be included?
|
||||||
*/
|
*/
|
||||||
exports.Filter.prototype.isIncluded = function(filepath) {
|
exports.Filter.prototype.isIncluded = function(filepath) {
|
||||||
filepath = path.resolve(process.env.PWD, filepath);
|
filepath = path.resolve(pwd, filepath);
|
||||||
|
|
||||||
if ( this.includePattern && !this.includePattern.test(filepath) ) {
|
if ( this.includePattern && !this.includePattern.test(filepath) ) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
/*global env: true */
|
|
||||||
/**
|
/**
|
||||||
@module jsdoc/src/scanner
|
@module jsdoc/src/scanner
|
||||||
@requires module:fs
|
@requires module:fs
|
||||||
@ -28,13 +27,14 @@ exports.Scanner.prototype.scan = function(searchPaths, depth, filter) {
|
|||||||
var isFile;
|
var isFile;
|
||||||
|
|
||||||
var filePaths = [];
|
var filePaths = [];
|
||||||
|
var pwd = process.env.PWD;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
searchPaths = searchPaths || [];
|
searchPaths = searchPaths || [];
|
||||||
depth = depth || 1;
|
depth = depth || 1;
|
||||||
|
|
||||||
searchPaths.forEach(function($) {
|
searchPaths.forEach(function($) {
|
||||||
var filepath = path.resolve( process.env.PWD, decodeURIComponent($) );
|
var filepath = path.resolve( pwd, decodeURIComponent($) );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
isFile = fs.statSync(filepath).isFile();
|
isFile = fs.statSync(filepath).isFile();
|
||||||
|
|||||||
@ -11,9 +11,13 @@
|
|||||||
* Enumeration of Markdown parsers that are available.
|
* Enumeration of Markdown parsers that are available.
|
||||||
* @enum {String}
|
* @enum {String}
|
||||||
*/
|
*/
|
||||||
var parsers = {
|
var parserNames = {
|
||||||
/** The "[markdown-js](https://github.com/evilstreak/markdown-js)" (aka "evilstreak") parser. */
|
/**
|
||||||
evilstreak: "markdown",
|
* The "[markdown-js](https://github.com/evilstreak/markdown-js)" (aka "evilstreak") parser.
|
||||||
|
*
|
||||||
|
* @deprecated Replaced by "marked," as markdown-js does not support inline HTML.
|
||||||
|
*/
|
||||||
|
evilstreak: "marked",
|
||||||
/**
|
/**
|
||||||
* The "GitHub-flavored Markdown" parser.
|
* The "GitHub-flavored Markdown" parser.
|
||||||
* @deprecated Replaced by "marked."
|
* @deprecated Replaced by "marked."
|
||||||
@ -44,48 +48,30 @@ function escapeUnderscores(source) {
|
|||||||
* the specified parser to transform the Markdown source to HTML, then returns the HTML as a string.
|
* the specified parser to transform the Markdown source to HTML, then returns the HTML as a string.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {String} parser The name of the selected parser.
|
* @param {String} parserName The name of the selected parser.
|
||||||
* @param {Object} [conf] Configuration for the selected parser, if any.
|
* @param {Object} [conf] Configuration for the selected parser, if any.
|
||||||
* @returns {Function} A function that accepts Markdown source, feeds it to the selected parser, and
|
* @returns {Function} A function that accepts Markdown source, feeds it to the selected parser, and
|
||||||
* returns the resulting HTML.
|
* returns the resulting HTML.
|
||||||
* @throws {Error} If the name does not correspond to a known parser.
|
* @throws {Error} If the name does not correspond to a known parser.
|
||||||
*/
|
*/
|
||||||
function getParseFunction(parser, conf) {
|
function getParseFunction(parserName, conf) {
|
||||||
conf = conf || {};
|
var marked = require('marked');
|
||||||
var parse;
|
var parserFunction;
|
||||||
|
|
||||||
if (parser === parsers.marked) {
|
conf = conf || {};
|
||||||
parser = require(parser);
|
|
||||||
parser.setOptions({
|
if (parserName === parserNames.marked) {
|
||||||
gfm: true,
|
parserFunction = function(source) {
|
||||||
tables: true,
|
|
||||||
breaks: false,
|
|
||||||
pedantic: false,
|
|
||||||
sanitize: true,
|
|
||||||
smartLists: true,
|
|
||||||
langPrefix: 'lang-'
|
|
||||||
});
|
|
||||||
parse = function(source) {
|
|
||||||
source = escapeUnderscores(source);
|
source = escapeUnderscores(source);
|
||||||
return parser(source)
|
return marked(source)
|
||||||
.replace(/\s+$/, '')
|
.replace(/\s+$/, '')
|
||||||
.replace(/'/g, "'");
|
.replace(/'/g, "'");
|
||||||
};
|
};
|
||||||
parse._parser = parsers.marked;
|
parserFunction._parser = parserNames.marked;
|
||||||
return parse;
|
return parserFunction;
|
||||||
} else if (parser === parsers.evilstreak) {
|
}
|
||||||
parser = require(parser).markdown;
|
else {
|
||||||
|
throw new Error("unknown Markdown parser: '" + parserName + "'");
|
||||||
parse = function(source) {
|
|
||||||
source = escapeUnderscores(source);
|
|
||||||
// evilstreak parser expects line endings to be \n
|
|
||||||
source = source.replace(/\r\n|\r/g, '\n');
|
|
||||||
return parser.toHTML(source, conf.dialect);
|
|
||||||
};
|
|
||||||
parse._parser = parsers.evilstreak;
|
|
||||||
return parse;
|
|
||||||
} else {
|
|
||||||
throw new Error("unknown Markdown parser: '" + parser + "'");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,12 +87,10 @@ function getParseFunction(parser, conf) {
|
|||||||
exports.getParser = function() {
|
exports.getParser = function() {
|
||||||
var conf = env.conf.markdown;
|
var conf = env.conf.markdown;
|
||||||
if (conf && conf.parser) {
|
if (conf && conf.parser) {
|
||||||
return getParseFunction(parsers[conf.parser], conf);
|
return getParseFunction(parserNames[conf.parser], conf);
|
||||||
} else if (conf && conf.githubRepoOwner && conf.githubRepoName) {
|
}
|
||||||
// use GitHub-friendly parser if GitHub-specific options are present
|
else {
|
||||||
return getParseFunction(parsers.gfm, conf);
|
// marked is the default parser
|
||||||
} else {
|
return getParseFunction(parserNames.marked, conf);
|
||||||
// evilstreak is the default parser
|
|
||||||
return getParseFunction(parsers.evilstreak, conf);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
115
node_modules/markdown/README.markdown
generated
vendored
115
node_modules/markdown/README.markdown
generated
vendored
@ -1,115 +0,0 @@
|
|||||||
markdown-js
|
|
||||||
===========
|
|
||||||
|
|
||||||
Yet another markdown parser, this time for JavaScript. There's a few
|
|
||||||
options that precede this project but they all treat markdown to HTML
|
|
||||||
conversion as a single step process. You pass markdown in and get HTML
|
|
||||||
out, end of story. We had some pretty particular views on how the
|
|
||||||
process should actually look, which include:
|
|
||||||
|
|
||||||
* producing well-formed HTML. This means that em and strong nesting is
|
|
||||||
important, as is the ability to output as both HTML and XHTML
|
|
||||||
|
|
||||||
* having an intermediate representation to allow processing of parsed
|
|
||||||
data (we in fact have two, both [JsonML]: a markdown tree and an
|
|
||||||
HTML tree)
|
|
||||||
|
|
||||||
* being easily extensible to add new dialects without having to
|
|
||||||
rewrite the entire parsing mechanics
|
|
||||||
|
|
||||||
* having a good test suite. The only test suites we could find tested
|
|
||||||
massive blocks of input, and passing depended on outputting the HTML
|
|
||||||
with exactly the same whitespace as the original implementation
|
|
||||||
|
|
||||||
[JsonML]: http://jsonml.org/ "JSON Markup Language"
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Just the `markdown` library:
|
|
||||||
|
|
||||||
npm install markdown
|
|
||||||
|
|
||||||
Also install `md2html` to `/usr/local/bin` (or wherever)
|
|
||||||
|
|
||||||
npm install -g markdown
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
The simple way to use it with CommonJS is:
|
|
||||||
|
|
||||||
var input = "# Heading\n\nParagraph";
|
|
||||||
var output = require( "markdown" ).markdown.toHTML( input );
|
|
||||||
print( output );
|
|
||||||
|
|
||||||
If you want more control check out the documentation in
|
|
||||||
[lib/markdown.js] which details all the methods and parameters
|
|
||||||
available (including examples!). One day we'll get the docs generated
|
|
||||||
and hosted somewhere for nicer browsing.
|
|
||||||
|
|
||||||
It also works in a browser; here is a complete example:
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<textarea id="text-input" oninput="this.editor.update()"
|
|
||||||
rows="6" cols="60">Type **Markdown** here.</textarea>
|
|
||||||
<div id="preview"> </div>
|
|
||||||
<script src="lib/markdown.js"></script>
|
|
||||||
<script>
|
|
||||||
function Editor(input, preview)
|
|
||||||
{
|
|
||||||
this.update = function () {
|
|
||||||
preview.innerHTML = markdown.toHTML(input.value);
|
|
||||||
}
|
|
||||||
input.editor = this;
|
|
||||||
this.update();
|
|
||||||
}
|
|
||||||
var $ = function (id) { return document.getElementById(id); };
|
|
||||||
new Editor($("text-input"), $("preview"));
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
### md2html
|
|
||||||
|
|
||||||
md2html /path/to/doc.md > /path/to/doc.html
|
|
||||||
|
|
||||||
[lib/markdown.js]: http://github.com/evilstreak/markdown-js/blob/master/lib/markdown.js
|
|
||||||
|
|
||||||
## Intermediate Representation
|
|
||||||
|
|
||||||
Internally the process to convert a chunk of markdown into a chunk of
|
|
||||||
HTML has three steps:
|
|
||||||
|
|
||||||
1. Parse the markdown into a JsonML tree. Any references found in the
|
|
||||||
parsing are stored in the attribute hash of the root node under the
|
|
||||||
key `references`.
|
|
||||||
|
|
||||||
2. Convert the markdown tree into an HTML tree. Rename any nodes that
|
|
||||||
need it (`bulletlist` to `ul` for example) and lookup any references
|
|
||||||
used by links or images. Remove the references attribute once done.
|
|
||||||
|
|
||||||
3. Stringify the HTML tree being careful not to wreck whitespace where
|
|
||||||
whitespace is important (surrounding inline elements for example).
|
|
||||||
|
|
||||||
Each step of this process can be called individually if you need to do
|
|
||||||
some processing or modification of the data at an intermediate stage.
|
|
||||||
For example, you may want to grab a list of all URLs linked to in the
|
|
||||||
document before rendering it to HTML which you could do by recursing
|
|
||||||
through the HTML tree looking for `a` nodes.
|
|
||||||
|
|
||||||
## Running tests
|
|
||||||
|
|
||||||
To run the tests under node you will need tap installed (it's listed as a
|
|
||||||
devDependencies so `npm install` from the checkout should be enough), then do
|
|
||||||
|
|
||||||
$ ./node_modules/.bin/tap test/*.t.js
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Do the usual github fork and pull request dance. Add yourself to the
|
|
||||||
contributors section of package.json too if you want to.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
Released under the MIT license.
|
|
||||||
3
node_modules/markdown/lib/index.js
generated
vendored
3
node_modules/markdown/lib/index.js
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
// super simple module for the most common nodejs use case.
|
|
||||||
exports.markdown = require("./markdown");
|
|
||||||
exports.parse = exports.markdown.toHTML;
|
|
||||||
1616
node_modules/markdown/lib/markdown.js
generated
vendored
1616
node_modules/markdown/lib/markdown.js
generated
vendored
File diff suppressed because it is too large
Load Diff
68
node_modules/markdown/package.json
generated
vendored
68
node_modules/markdown/package.json
generated
vendored
@ -1,68 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "markdown",
|
|
||||||
"version": "0.4.0",
|
|
||||||
"description": "A sensible Markdown parser for javascript",
|
|
||||||
"keywords": [
|
|
||||||
"markdown",
|
|
||||||
"text processing",
|
|
||||||
"ast"
|
|
||||||
],
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "Dominic Baggott",
|
|
||||||
"email": "dominic.baggott@gmail.com",
|
|
||||||
"url": "http://evilstreak.co.uk"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Ash Berlin",
|
|
||||||
"email": "ash_markdownjs@firemirror.com",
|
|
||||||
"url": "http://ashberlin.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Dominic Baggott",
|
|
||||||
"email": "dominic.baggott@gmail.com",
|
|
||||||
"url": "http://evilstreak.co.uk"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Ash Berlin",
|
|
||||||
"email": "ash_markdownjs@firemirror.com",
|
|
||||||
"url": "http://ashberlin.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"bugs": {
|
|
||||||
"url": "http://github.com/evilstreak/markdown-js/issues"
|
|
||||||
},
|
|
||||||
"licenses": [
|
|
||||||
{
|
|
||||||
"type": "MIT",
|
|
||||||
"url": "http://www.opensource.org/licenses/mit-license.php"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git://github.com/evilstreak/markdown-js.git"
|
|
||||||
},
|
|
||||||
"main": "./lib/index.js",
|
|
||||||
"bin": {
|
|
||||||
"md2html": "./bin/md2html.js"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"nopt": "1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"tap": "0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "tap test/*.t.js"
|
|
||||||
},
|
|
||||||
"readme": "markdown-js\n===========\n\nYet another markdown parser, this time for JavaScript. There's a few\noptions that precede this project but they all treat markdown to HTML\nconversion as a single step process. You pass markdown in and get HTML\nout, end of story. We had some pretty particular views on how the\nprocess should actually look, which include:\n\n * producing well-formed HTML. This means that em and strong nesting is\n important, as is the ability to output as both HTML and XHTML\n\n * having an intermediate representation to allow processing of parsed\n data (we in fact have two, both [JsonML]: a markdown tree and an\n HTML tree)\n\n * being easily extensible to add new dialects without having to\n rewrite the entire parsing mechanics\n\n * having a good test suite. The only test suites we could find tested\n massive blocks of input, and passing depended on outputting the HTML\n with exactly the same whitespace as the original implementation\n\n[JsonML]: http://jsonml.org/ \"JSON Markup Language\"\n\n## Installation\n\nJust the `markdown` library:\n\n npm install markdown\n\nAlso install `md2html` to `/usr/local/bin` (or wherever)\n\n npm install -g markdown\n\n## Usage\n\nThe simple way to use it with CommonJS is:\n\n var input = \"# Heading\\n\\nParagraph\";\n var output = require( \"markdown\" ).markdown.toHTML( input );\n print( output );\n\nIf you want more control check out the documentation in\n[lib/markdown.js] which details all the methods and parameters\navailable (including examples!). One day we'll get the docs generated\nand hosted somewhere for nicer browsing.\n\nIt also works in a browser; here is a complete example:\n\n <!DOCTYPE html>\n <html>\n <body>\n <textarea id=\"text-input\" oninput=\"this.editor.update()\"\n rows=\"6\" cols=\"60\">Type **Markdown** here.</textarea>\n <div id=\"preview\"> </div>\n <script src=\"lib/markdown.js\"></script>\n <script>\n function Editor(input, preview)\n {\n this.update = function () {\n preview.innerHTML = markdown.toHTML(input.value);\n }\n input.editor = this;\n this.update();\n }\n var $ = function (id) { return document.getElementById(id); };\n new Editor($(\"text-input\"), $(\"preview\"));\n </script>\n </body>\n </html>\n\n### md2html\n\n md2html /path/to/doc.md > /path/to/doc.html\n\n[lib/markdown.js]: http://github.com/evilstreak/markdown-js/blob/master/lib/markdown.js\n\n## Intermediate Representation\n\nInternally the process to convert a chunk of markdown into a chunk of\nHTML has three steps:\n\n 1. Parse the markdown into a JsonML tree. Any references found in the\n parsing are stored in the attribute hash of the root node under the\n key `references`.\n\n 2. Convert the markdown tree into an HTML tree. Rename any nodes that\n need it (`bulletlist` to `ul` for example) and lookup any references\n used by links or images. Remove the references attribute once done.\n\n 3. Stringify the HTML tree being careful not to wreck whitespace where\n whitespace is important (surrounding inline elements for example).\n\nEach step of this process can be called individually if you need to do\nsome processing or modification of the data at an intermediate stage.\nFor example, you may want to grab a list of all URLs linked to in the\ndocument before rendering it to HTML which you could do by recursing\nthrough the HTML tree looking for `a` nodes.\n\n## Running tests\n\nTo run the tests under node you will need tap installed (it's listed as a\ndevDependencies so `npm install` from the checkout should be enough), then do\n\n $ ./node_modules/.bin/tap test/*.t.js\n\n## Contributing\n\nDo the usual github fork and pull request dance. Add yourself to the\ncontributors section of package.json too if you want to.\n\n## License\n\nReleased under the MIT license.\n",
|
|
||||||
"readmeFilename": "README.markdown",
|
|
||||||
"_id": "markdown@0.4.0",
|
|
||||||
"dist": {
|
|
||||||
"shasum": "6a5d7cb751c1d1e6adc374d40e9d358474b59a8e"
|
|
||||||
},
|
|
||||||
"_resolved": "git://github.com/jsdoc3/markdown-js.git#fd27f4c979f3f71e82e1fe76ffe6415980b31f00",
|
|
||||||
"_from": "git://github.com/jsdoc3/markdown-js.git"
|
|
||||||
}
|
|
||||||
@ -21,7 +21,6 @@
|
|||||||
"esprima": "1.0.4",
|
"esprima": "1.0.4",
|
||||||
"js2xmlparser": "0.1.0",
|
"js2xmlparser": "0.1.0",
|
||||||
"jshint": "0.9.1",
|
"jshint": "0.9.1",
|
||||||
"markdown": "git+https://github.com/jsdoc3/markdown-js.git",
|
|
||||||
"marked": "0.2.8",
|
"marked": "0.2.8",
|
||||||
"taffydb": "git+https://github.com/hegemonic/taffydb.git",
|
"taffydb": "git+https://github.com/hegemonic/taffydb.git",
|
||||||
"underscore": "1.4.2",
|
"underscore": "1.4.2",
|
||||||
|
|||||||
@ -12,6 +12,20 @@ var parse = require('jsdoc/util/markdown').getParser();
|
|||||||
var tags = [];
|
var tags = [];
|
||||||
var excludeTags = [];
|
var excludeTags = [];
|
||||||
|
|
||||||
|
function shouldProcessString(tagName, text) {
|
||||||
|
var shouldProcess = false;
|
||||||
|
|
||||||
|
if (tagName !== 'see') {
|
||||||
|
shouldProcess = true;
|
||||||
|
}
|
||||||
|
// we only want to process `@see` tags that contain Markdown links
|
||||||
|
else if (tagName === 'see' && text.indexOf('[') !== -1) {
|
||||||
|
shouldProcess = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return shouldProcess;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the markdown source in a doclet. The properties that should be
|
* Process the markdown source in a doclet. The properties that should be
|
||||||
* processed are configurable, but always include "classdesc", "description",
|
* processed are configurable, but always include "classdesc", "description",
|
||||||
@ -24,19 +38,18 @@ function process(doclet) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof doclet[tag] === "string" &&
|
if (typeof doclet[tag] === "string" && shouldProcessString(tag, doclet[tag]) ) {
|
||||||
(tag != 'see' ||
|
|
||||||
// treat '@see' specially, since we only want to process @see text that contains links
|
|
||||||
(tag == 'see' && doclet[tag].indexOf('[') != -1))) {
|
|
||||||
doclet[tag] = parse(doclet[tag]);
|
doclet[tag] = parse(doclet[tag]);
|
||||||
} else if (doclet[tag] instanceof Array) {
|
}
|
||||||
doclet[tag].forEach(function(value, index, original){
|
else if ( Array.isArray(doclet[tag]) ) {
|
||||||
|
doclet[tag].forEach(function(value, index, original) {
|
||||||
var inner = {};
|
var inner = {};
|
||||||
inner[tag] = value;
|
inner[tag] = value;
|
||||||
process(inner);
|
process(inner);
|
||||||
original[index] = inner[tag];
|
original[index] = inner[tag];
|
||||||
});
|
});
|
||||||
} else if (doclet[tag]) {
|
}
|
||||||
|
else if (doclet[tag]) {
|
||||||
process(doclet[tag]);
|
process(doclet[tag]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,86 +0,0 @@
|
|||||||
# How to use the Markdown plugin
|
|
||||||
|
|
||||||
For most users, all you need to do is add the plugin to your JSDoc configuration (`conf.json`) as you would any other, by adding a reference to the plugin in the `"plugins"` entry:
|
|
||||||
|
|
||||||
...
|
|
||||||
"plugins": [ "plugins/markdown" ]
|
|
||||||
...
|
|
||||||
|
|
||||||
This will cause Markdown in `@description` tags (including implicit descriptions without tags), `@classdesc` tags, `@param` tags, `@property` tags, and `@returns` tags to be parsed.
|
|
||||||
|
|
||||||
Also, be sure to use leading asterisks in your doc comments! If you omit the leading asterisks, JSDoc's code parser may remove other asterisks that are used for Markdown formatting.
|
|
||||||
|
|
||||||
# Configuring the Markdown plugin
|
|
||||||
|
|
||||||
The plugin also offers several configuration options for advanced users who want GitHub integration, extended tag support, etc. All configuration for the Markdown plugin should be added to a `"markdown"` property in your JSDoc configuration:
|
|
||||||
|
|
||||||
...
|
|
||||||
"plugins": [ "plugins/markdown" ],
|
|
||||||
|
|
||||||
"markdown": {
|
|
||||||
"opt1": "value",
|
|
||||||
"opt2": [ "foo", "bar", "baz" ]
|
|
||||||
}
|
|
||||||
...
|
|
||||||
|
|
||||||
## Choosing a parser
|
|
||||||
|
|
||||||
The plugin currently supports two Markdown parsers. You can select which parser to use by adding a `"parser"` property to your Markdown configuration:
|
|
||||||
|
|
||||||
...
|
|
||||||
"plugins": [ "plugins/markdown" ],
|
|
||||||
|
|
||||||
"markdown": {
|
|
||||||
"parser": "gfm"
|
|
||||||
}
|
|
||||||
...
|
|
||||||
|
|
||||||
### Dominic "evilstreak" Baggott's markdown-js
|
|
||||||
|
|
||||||
The default parser is Dominic Baggott's excellent [markdown-js](https://github.com/evilstreak/markdown-js). It can be explicitly selected by setting the `parser` to `evilstreak` and has one additional (and optional) configuration option, `dialect`, which can be used to select which of markdown-js' built-in dialects to use. If omitted, markdown-js' default dialect will be used.
|
|
||||||
|
|
||||||
...
|
|
||||||
"plugins": [ "plugins/markdown" ],
|
|
||||||
|
|
||||||
"markdown": {
|
|
||||||
"parser": "evilstreak",
|
|
||||||
"dialect": "Maruku"
|
|
||||||
}
|
|
||||||
...
|
|
||||||
|
|
||||||
### GitHib Flavored Markdown
|
|
||||||
|
|
||||||
The alternative parser is the modified Showdown parser supplied by GitHub for their [GitHub Flavored Markdown](http://github.github.com/github-flavored-markdown/). GFM provides several enhancements to standard Markdown syntax (see its documentation) intended to be useful to developers. It *also* has the ability to quickly link to GitHub repositories, files, and issues. It can be selected by setting the `parser` to `gfm` and supports three additional (and optional) configuration options.
|
|
||||||
|
|
||||||
The `hardwrap` option controls the hard wrapping of line ends. Unlike standard Markdown, GFM considers a single newline to indicate a "hard break" in the paragraph, but this doesn't work well with the line length limitations commonly used with comment documentation, so is disabled by default. If you want to turn hard wrapping back on, set `hardwrap` to `true` (or any non-falsy value).
|
|
||||||
|
|
||||||
The `githubRepoName` and `githubRepoOwner` indicate which GitHub repo should be used for GitHub links that do not fully specify a repo. These options have no effect unless used together, and if they are omitted, several of GFM's default link types will be unavailable. Conversely, if you supply both `github*` options but do not explicitly select `gfm` as your parser, it will be automatically selected for you.
|
|
||||||
|
|
||||||
...
|
|
||||||
"plugins": [ "plugins/markdown" ],
|
|
||||||
|
|
||||||
"markdown": {
|
|
||||||
"parser": "gfm",
|
|
||||||
"hardwrap": true
|
|
||||||
}
|
|
||||||
...
|
|
||||||
|
|
||||||
### Why two parsers?
|
|
||||||
|
|
||||||
The "evilstreak" parser is flexible, extensible, currently maintained, and was the only parser available in earlier versions of the Markdown plugin, but doesn't support the useful GFM extensions. The "gfm" parser is based on the no-longer-maintained Showdown parser, but it provides GFM extensions.
|
|
||||||
|
|
||||||
In the future, if GFM support is made available for the "evilstreak" parser, this plugin will drop the "gfm" parser in favor of that support.
|
|
||||||
|
|
||||||
## Extended tag support
|
|
||||||
|
|
||||||
While the Markdown plugin already supports JSDoc's default tags, if you're using other plugins, you may well have extra tags available. You can tell the Markdown plugin to handle those extra tags as well using the `tags` property, which is an array of the tags* it should check in addition to the default set.
|
|
||||||
|
|
||||||
...
|
|
||||||
"plugins": [ "plugins/markdown" ],
|
|
||||||
|
|
||||||
"markdown": {
|
|
||||||
"tags": [ "foo", "bars", "bazzes" ]
|
|
||||||
}
|
|
||||||
...
|
|
||||||
|
|
||||||
\* Because the Markdown plugin works with JSDoc's internal representation rather than with the source comments, the names you need to enter in the `tags` property aren't necessarily the same as the actual tag names. For example, in the default set of tags, `@param` is stored under `params`. If you are having trouble getting the Markdown plugin to work with your extra tags, either take a peek at the output of JSDoc's `--explain` command-line parameter (which displays the internal state that plugins work with) or ask the plugin author which "doclet properties" their plugin uses. The Markdown plugin supports strings, arrays, and objects/subdoclets.
|
|
||||||
13
test/fixtures/exportstag5.js
vendored
Normal file
13
test/fixtures/exportstag5.js
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
define(function() {
|
||||||
|
'use strict';
|
||||||
|
var bar = function() {};
|
||||||
|
/** @exports Foo */
|
||||||
|
var Foo = Object.create(
|
||||||
|
/** @lends module:Foo.prototype */
|
||||||
|
{
|
||||||
|
/** This should be in the Foo module doc. */
|
||||||
|
bar : function() {}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return Foo;
|
||||||
|
});
|
||||||
@ -1,4 +1,4 @@
|
|||||||
/*global describe: true, env: true, expect: true, it: true */
|
/*global describe: true, expect: true, it: true */
|
||||||
describe("jsdoc/src/filter", function() {
|
describe("jsdoc/src/filter", function() {
|
||||||
var filter = new (require('jsdoc/src/filter').Filter)({
|
var filter = new (require('jsdoc/src/filter').Filter)({
|
||||||
includePattern: new RegExp(".+\\.js(doc)?$"),
|
includePattern: new RegExp(".+\\.js(doc)?$"),
|
||||||
@ -6,7 +6,7 @@ describe("jsdoc/src/filter", function() {
|
|||||||
exclude: ['.ignore', 'scratch/conf.js']
|
exclude: ['.ignore', 'scratch/conf.js']
|
||||||
});
|
});
|
||||||
|
|
||||||
var files = ['yes.js', '/yes.jsdoc', '/_nope.js', '.ignore', env.dirname + '/scratch/conf.js'];
|
var files = ['yes.js', '/yes.jsdoc', '/_nope.js', '.ignore', process.env.PWD + '/scratch/conf.js'];
|
||||||
|
|
||||||
files = files.filter(function($) {
|
files = files.filter(function($) {
|
||||||
return filter.isIncluded($);
|
return filter.isIncluded($);
|
||||||
|
|||||||
@ -6,10 +6,10 @@ describe("jsdoc/src/scanner", function() {
|
|||||||
excludePattern: new RegExp("(^|\\/|\\\\)_")
|
excludePattern: new RegExp("(^|\\/|\\\\)_")
|
||||||
}),
|
}),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
sourceFiles = scanner.scan([path.join(env.dirname, 'test', 'fixtures', 'src')], 3, filter);
|
sourceFiles = scanner.scan([path.join(process.env.PWD, 'test', 'fixtures', 'src')], 3, filter);
|
||||||
|
|
||||||
sourceFiles = sourceFiles.map(function($) {
|
sourceFiles = sourceFiles.map(function($) {
|
||||||
return path.relative(env.dirname, $);
|
return path.relative(process.env.PWD, $);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return the correct source files", function() {
|
it("should return the correct source files", function() {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/*global describe: true, env: true, it: true */
|
/*global describe: true, env: true, expect: true, it: true */
|
||||||
describe("jsdoc/tutorial", function() {
|
describe("jsdoc/tutorial", function() {
|
||||||
var tutorial = require('jsdoc/tutorial'),
|
var tutorial = require('jsdoc/tutorial'),
|
||||||
name = "tuteID",
|
name = "tuteID",
|
||||||
@ -209,8 +209,6 @@ describe("jsdoc/tutorial", function() {
|
|||||||
|
|
||||||
it("Tutorials with MARKDOWN type go through the markdown parser, respecting configuration options", function() {
|
it("Tutorials with MARKDOWN type go through the markdown parser, respecting configuration options", function() {
|
||||||
var old = env.conf.markdown;
|
var old = env.conf.markdown;
|
||||||
env.conf.markdown = {parser: 'evilstreak'};
|
|
||||||
expect(par.parse()).toBe("<h1>This is the parent tutorial's <em>content & stuff</em> A<em>B X</em>Y</h1>");
|
|
||||||
|
|
||||||
env.conf.markdown = {parser: 'marked'};
|
env.conf.markdown = {parser: 'marked'};
|
||||||
expect(par.parse()).toBe("<h1>This is the parent tutorial's <em>content & stuff</em> A_B X_Y</h1>");
|
expect(par.parse()).toBe("<h1>This is the parent tutorial's <em>content & stuff</em> A_B X_Y</h1>");
|
||||||
|
|||||||
@ -40,7 +40,7 @@ describe('jsdoc/util/markdown', function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
it('should retrieve a function when called with default settings', function() {
|
it('should retrieve a function when called with default settings', function() {
|
||||||
var storage = setMarkdownConf({parser: 'evilstreak'});
|
var storage = setMarkdownConf({});
|
||||||
|
|
||||||
var parser = markdown.getParser();
|
var parser = markdown.getParser();
|
||||||
expect(typeof parser).toEqual('function');
|
expect(typeof parser).toEqual('function');
|
||||||
@ -52,10 +52,10 @@ describe('jsdoc/util/markdown', function() {
|
|||||||
restoreMarkdownConf(storage);
|
restoreMarkdownConf(storage);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should use the evilstreak parser when requested', function() {
|
it('should use the marked parser when evilstreak is requested', function() {
|
||||||
var storage = setMarkdownConf({parser: 'evilstreak'});
|
var storage = setMarkdownConf({parser: 'evilstreak'});
|
||||||
var parser = markdown.getParser();
|
var parser = markdown.getParser();
|
||||||
expect(parser._parser).toEqual('markdown');
|
expect(parser._parser).toEqual('marked');
|
||||||
restoreMarkdownConf(storage);
|
restoreMarkdownConf(storage);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -73,16 +73,6 @@ describe('jsdoc/util/markdown', function() {
|
|||||||
restoreMarkdownConf(storage);
|
restoreMarkdownConf(storage);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not apply formatting to inline tags when the evilstreak parser is enabled', function() {
|
|
||||||
var storage = setMarkdownConf({parser: 'evilstreak'});
|
|
||||||
var parser = markdown.getParser();
|
|
||||||
|
|
||||||
// get the evilstreak parser and do the test
|
|
||||||
expect(parser('{@link MyClass#_x} and {@link MyClass#_y}')).toEqual(
|
|
||||||
'<p>{@link MyClass#_x} and {@link MyClass#_y}</p>');
|
|
||||||
restoreMarkdownConf(storage);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not apply formatting to inline tags when the marked parser is enabled', function() {
|
it('should not apply formatting to inline tags when the marked parser is enabled', function() {
|
||||||
var storage = setMarkdownConf({parser: 'marked'});
|
var storage = setMarkdownConf({parser: 'marked'});
|
||||||
var parser = markdown.getParser();
|
var parser = markdown.getParser();
|
||||||
|
|||||||
@ -85,4 +85,13 @@ describe("@exports tag", function() {
|
|||||||
expect(typeof method).toEqual('object');
|
expect(typeof method).toEqual('object');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('variable shadowing', function() {
|
||||||
|
var docSet = jasmine.getDocSetFromFile('test/fixtures/exportstag5.js');
|
||||||
|
var method = docSet.getByLongname('module:Foo#bar')[0];
|
||||||
|
|
||||||
|
it('A variable defined in an inner scope should correctly shadow a variable in an outer scope.', function() {
|
||||||
|
expect(method.description).toBe('This should be in the Foo module doc.');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user