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
Documentation: Organize dartdoc API output #33
Comments
I'm making some progress using the 'categories' feature in dartdoc. By tagging classes with the following (in the prefixing comment):
and making some entries in dartdoc_options.yaml along with some commandline options, dartdoc lists the categories in the left sidebar under 'Topics'. Clicking on a category in the 'Topics' list displays the classes tagged with that category. |
Here's what I've been able to do, so far. Note the categories may not be correct or complete - this just shows how it works. https://rickbsgu.github.io/mix/apidoc/ Note the 'Topics' column in the left side bar. You can click on any of those for a list of classes that fall under that 'Topic' (category). |
@rickbsgu this looks really good! This will make things much easier to navigate. |
No longer applicableLocation: my fork https://github.com/rickbsgu/mix, branch rickb-docs-2. The overall 'mix' library is still there, it's just excluded from the documentation generation so that it doesn't generate duplicate content. The 'mix' library exports the category libraries rather than the lower level source files. I ran the tests to make sure this works - it all seems to work just fine. I think this may be a better way to go rather than by categories by virtue of the fact that everything that is in that library gets documented as part of that library - global functions, constants, extensions, etc. Categories only includes classes (as far as I've been able to tell.) Note that we can exclude content as we want. We can also go as fine-grained as we want. For instance, an entire library could be devoted to 'image attributes' which would only list those that make sense for attributes. Similar for text attributes, iconattributes, Decorators, Variants, etc. Downsides:
|
Well, after actually using it, I'm less convinced it's useful as it is. Have to think on it some more. Update |
Ok, after a bit of a hiatus, I've taken another swing at this. I think this effort works much better. This is not complete, but it illustrates the approach sufficiently well to determine whether to move forward or no. My fork and branch: https://github.com/rickbsgu/mix/tree/rickb-docs-4 Points:
Example:
Now, in the documentation for the BoxUtility class Static Functions list, the output looks like this:
Upsides
Downsides
Side BenefitsA side benefit of this approach has been that it exposes inconsistencies and omissions.
Some of the Short Codes are inconsistently defined, or missing. For instance, for the BoxUtility.marginHorizontal() function, the corresponding Short Codes are marginHorizontal, marginX, and mx, but for the BoxUtility.paddingHorizontal() function we have paddingHorizontal and px, but no paddingX. Also, we have BoxUtility and TextUtility but TextDirectiveUtils. Some of the static utility functions are defined as arrow functions and some are defined with normal braced function syntax (simple return functions.) Admittedly these are minor points, but inconsistencies can be glaring to a user — when you're cooking along, it can be jarring to have to check to see if a utility class ends in '...Utils' or '...Utility', or find out that an expected Short Code like paddingX isn't there. SynopsisIt's not perfect — ideally the Short Codes would be automatically generated in a way that collects them with their corresponding widget & we wouldn't have to do so much manually. But, the approach has the benefit of keeping the Short Codes with their Utility functions and, the attention required to document them exposes inconsistencies and omissions. It's a PITA, but I think it's worth it. PSI've filed some issues in the dartdoc project:
The first two would be useful for items like Directives, which would be a subcategory or additional category to Attributes. The third would be useful for things like Short Codes and other global constants and function. The rest are just annoying or bugs. |
@rickbsgu This looks really good!! I believe there could be some adjustment to the category Mix Object, but I think overall the topics is the way to go! |
Ok. I've refactored the decorator classes to be more in line with the rest of the classes, especially with regards to utilities and short utils and how they show up in the documentation. This shouldn't introduce any breaking changes - all the class names are the same and the Mix exports are the same. I'll be checking this further. Note: I've run all the tests, some of which use decorator classes - they all pass. Relevant changes:
The result is the decorator class definitions are now consistent with the the rest of the attribute definitions, and document consistently. |
The folks at dartdoc have been quite responsive - note they've fixed two of the issues listed above (purple checks) which improve the organization of the output, greatly. |
That is great news!!! |
I think we can close this with the pull merge. |
dartdoc lumps all of the classes together without any distinction. Same with functions, constants, etc.
These need to organized under header by type, category, etc.
Not straightforward. Investigating.
The text was updated successfully, but these errors were encountered: