Skip to content

Commit

Permalink
Add option for alphabetic sorting
Browse files Browse the repository at this point in the history
Adds `options.sort` to `docdown(options)`. If `options.sort` is `true`,
then the methods (and categories, if enabled) are sorted alphabetically
in the documentation. If `false`, then methods (and categories) are
ordered as they appear in source. Defaults to `true`.

Fixes: jdalton#3
  • Loading branch information
DannyNemer committed Jan 29, 2016
1 parent 16dac60 commit 565a99a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function docdown(options) {
'lang': 'js',
'sort': true,
'title': path.basename(options.path) + ' API documentation',
'sort': true,
'toc': 'properties'
});

Expand Down
4 changes: 2 additions & 2 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function generateDoc(source, options) {

// Sort categories and add special categories back.
if (sortEntries) {
tocGroups.sort(util.compareNatural);
if (sortEntries) tocGroups.sort(util.compareNatural);
}
push.apply(tocGroups, catogoriesUsed);
}
Expand Down Expand Up @@ -354,4 +354,4 @@ function generateDoc(source, options) {
return docMarkdown.join('\n');
}

module.exports = generateDoc;
module.exports = generateDoc;

0 comments on commit 565a99a

Please sign in to comment.