-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Show directive selector in generated API docs #3983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is there a certain way this should be formatted/templated within // categorizer.js
/**
* Function that walks through all inherited docs and collects public selectors.
* Only the md- selectors should be shown (not the mat- selectors).
*/
function resolveMdSelectors(classDoc) {
let onlyMdSelectors = [];
classDoc.decorators.forEach(function(decorator) {
decorator.arguments.forEach(function(argument) {
// Split the stringified object by newline to get each part
let argParts = argument.split('\n');
// Get the selector line with `selector: \'` in order to ignore such things as `{selector: MAT_ELEMENTS_SELECTOR}`
let selectorLine = argParts.filter(argPart => argPart.indexOf('selector: \'') !== -1)[0];
if (selectorLine) {
// Set the bookending ticks for grabbing the selectors
let firstTick = selectorLine.indexOf('\'') + 1;
let lastTick = selectorLine.indexOf('\'', firstTick);
// Get the selectors.
let selectors = selectorLine.substring(firstTick, lastTick).replace(/ /g, '').split(',');
onlyMdSelectors = selectors.filter(selector => selector.indexOf('md') !== -1);
}
});
});
return onlyMdSelectors;
} If there's a better way of getting the selectors, I'd be happy to clean that up. |
@jbh check out the existing As for how to show this information in the template- I was thinking it should go directly underneath the class name for any Thinking about this more, we should also have a blacklist for deprecated selectors. This would include, for now: |
@jelbourn To clarify the blacklist, do you mean a blacklist constant to be maintained within Also, when you said
Did you mean to just exclude |
@jbh yeah, I would just put the blacklist there for now. Anything in that list would be ignored when decorating the doc object. For prefixes, yes- I meant anything with the |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The API docs do not currently show the selector for directives. We should surface this information. This will involve collecting the information in
categorizer.js
and then adding it to theclass.template.html
.Only the
md-
selectors should be shown (not themat-
selectors).The follow-up would be styling the information on material.angular.io.
The text was updated successfully, but these errors were encountered: