Skip to content

Commit 8ea9e83

Browse files
authored
Expose formatParameter as a formatter (#546)
This allows custom themes to override it
1 parent 2eff668 commit 8ea9e83

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/output/util/formatters.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ module.exports = function (getHref) {
2626
* @param {boolean} short whether to cut the details and make it skimmable
2727
* @returns {string} formatted parameter representation.
2828
*/
29-
function formatParameter(param, short) {
29+
formatters.parameter = function (param, short) {
3030
if (short) {
3131
return (param.type && param.type.type == Syntax.OptionalType) ?
3232
'[' + param.name + ']' : param.name;
3333
}
3434
return param.name + ': ' + formatters.type(param.type).replace(/\n/g, '');
35-
}
35+
};
3636

3737
/**
3838
* Convert a remark AST to a string of HTML, rerouting links as necessary
@@ -87,7 +87,7 @@ module.exports = function (getHref) {
8787
formatters.parameters = function (section, short) {
8888
if (section.params) {
8989
return '(' + section.params.map(function (param) {
90-
return formatParameter(param, short);
90+
return formatters.parameter(param, short);
9191
}).join(', ') + ')';
9292
}
9393
return '()';

0 commit comments

Comments
 (0)