tui.jsdoc-template icon indicating copy to clipboard operation
tui.jsdoc-template copied to clipboard

Change style of opt Param indicator

Open DerHerrGammler opened this issue 6 years ago • 7 comments

I think it's not the best idea if the indicator for the optional parameters have the same style as the parameter name. In this example the 3rd parameter is optional and names oOptions but because its optional the added opt is confusing: grafik

DerHerrGammler avatar Apr 20 '18 11:04 DerHerrGammler

Yeah, I totally agree. A whole new design coming soon! Thanks!

minkyu-yi avatar May 13 '18 05:05 minkyu-yi

+1

yo35 avatar Jul 22 '18 10:07 yo35

Hi, @minkyu-yi Any news regarding this issue? (and regarding the new design you mentioned?)

yo35 avatar Sep 05 '21 14:09 yo35

@yo35 fork the repo and go to publish.js and replace function getSignatureAttributes(item) with:

function getSignatureAttributes(item) {
    var attributes = [];

    if (item.optional) {
//or whatever string works for you
        attributes.push(' *optional* ');
    }

    if (item.nullable === true) {
        attributes.push('nullable');
    }
    else if (item.nullable === false) {
        attributes.push('non-null');
    }

    return attributes;
}

akoumari avatar Jan 26 '22 22:01 akoumari

@akoumari In my opinion, it would be better to fix function updateItemName:

function updateItemName(item) {
    var attributes = getSignatureAttributes(item);
    var itemName = item.name || '';

    if (item.variable) {
        itemName = '…' + itemName;
    }

    if (attributes && attributes.length) {
        itemName = util.format( '%s <span class="signature-attributes">%s</span>', itemName, attributes.join(', ') );
        // instead of: ... '%s<span class="signature-attributes">%s</span>' ...
    }

    return itemName;
}

(this fixes the issue for all attributes, not only optional)

Additionally, it might be relevant to customize the font for the signature attributes, so that those attributes could be easily distinguish from the parameter names.

yo35 avatar Jan 27 '22 09:01 yo35

@yo35 Ohh yeah! I was just going for the low hanging fix but this significantly better.

akoumari avatar Jan 27 '22 12:01 akoumari

sorry. I'm not an maintainer at this time 😢. This repository is managed by nhn corp.

minkyu-yi avatar Feb 04 '22 06:02 minkyu-yi