-
Notifications
You must be signed in to change notification settings - Fork 30
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
Inconsistencies in jsDoc comments #171
Comments
@fabianmoronzirfas happy to help! Should we split the files by 3 or 4 (if @ffd8 is in too)? This is looks better for me ... but I'm happy to follow any recommendation.
|
I think we also need to decide how the doc should look in the end. This should help us to come up with a consistent version for the inline docs. From the Skype call, I remember that we want to aim for something close to p5.js. I think a good function to start from is something like I'm super busy the next two weeks, could only look into it afterwards, maybe somebody is willing and has the time to come up with something before that? |
@trych Good call! But can we do this as 2nd step and first fix things e.g. missing and wrong parameters etc. And then look into the "text" and examples? |
If we @ffd8 is with us splitting the files into 4 would be good. I think there is no hurry ( @trych ) action needed. I can work with the current state. I just wanted to point that out.
I'm totally fine with whatever we come up with. It just should be consistent. Another thing that I saw is that we also have sometimes a
Or something like this. @trych My aim is the following: index page with all the functions and then a sub page for each function. The subpages need a lot of love. I can generate them but if we want to add further infos we need to write this by hand. What we can do is automagically include an example script. I can build something that allows to include a file that is next to the index.md and it will be displayed as source code. The current state is still very rough but can be seen here. It is fully generated. No manual work done yet. https://basiljs.github.io/ |
👍 + Great! Just ... what is the difference between a collection and an array? Can/should we not simply always refer to array? @fabianmoronzirfas Can you as the master of doc simply define the jsDoc style/structure/rules? Might be easier and quicker than to have a long thread on this. |
A
Yes I can! muahahahahahah! |
Yep, let's try to generate as much as possible, but also allow for additional info.
We should differentiate between snippets and example scripts. We should absolutely have a snippet for each function or even multiple if there are several options per function. A link to an example script would also be nice, but should only be an addition. It could be a link to a script sitting in the example scripts directory (which btw. we also wanted to move to a separate repository). |
True
Also True |
Hi guys– sorry for delay on this, got pulled into a webapp dev for our school since december and my basil.js love has suffered... nevertheless, great plans above! Sure- happy to join for splitting up the files and going through with fine comb. Re: Subpages– there is one benefit to having basic text descriptions dumped like it is on the current website, allowing one to do a 'find' across the page for keywords (students use this all the time if not knowing the exact name of function). I wonder if there's a nice compromise that allows the organized reference list first (like we have it), descriptions (as we have it), then an accordion-style expanding snippet and potential isolated function example (when it exists). All staying within the same page, to avoid having to go forward/back/reload all the time? Just reveal/hide on demand. |
Okay. I will create some issues for that and assign each of us some files to review. Before I will write down some hints what to look for and how a comment should be formatted so we get a good result.
Yes this is what I also do. I was thinking of adding lunar.js to the page to allow a full text search.
Yes I want to create that.
This too.
I actually don't want to overload the site with JS features. The site should work without JS (except for the full text search of course) IMHO. Having all the Snippets in there would make the site very large for no script users. Having the subpage where we repeat the content of the index and go into detail is exactly what Processing & P5.js are doing. I think these references work pretty well. |
I'm a jerk and I stopped caring about no-script users (~ 0.25 – 2% of users). I'd imagine if someone's looking into basil.js, they're down with javascript. But true, for a no-script person, all the expanded divs would go on and on..
Very nice looking lib and I guess it's main benefit is filtering out (hiding) content that didn't match, vs doing a browser window search/find and it jumping to the highlighted word? Hm and a normal window search probably doesn't find collapsed text, so that lib would be helpful if it went that route. The other reference pages do work well, was just throwing out the idea if there's a benefit to a single page mighty reference, but maybe not. |
I was too (jquery-bootstrapping-light-boxing my live away), but then I just recently came across this post ("Most of the web really sucks if you have a slow connection") by danluu and it made me think. If I would add something like a accordion reveal/hide mechanism I would not code it myself from scratch. This would mean to add in some library (bootstrap?). Then we start adding in jQuery and what not and have one of these bloated sites. So my aim is to have a site that looks good and works well without JS. 😉 It is actually not about the no script users or being a jerk. It's about having a good connection or not. When I look up a reference in 3G on the train or the subway (that happens more often to me than you actually think) I want it to load fast. I also have been in Quito recently. The slow and laggy connections in hotels made it hard to use any of the JS magic sites. Anyway. I could go on and on. I think you get my point.
Sure. I get it. As you see I thought a lot about it too. The subpages would also allow easier to contribution of tutorials and snippets. Currently they are Markdown only. Contribute a snippet into a jekyll/liquid index.html is really hard if you don't know liquid. |
I wrote some remarks on how to use JSDoc comments in Basil. See the wiki. https://github.com/basiljs/basil.js/wiki/Writing-Documentation Is something missing? |
One thing that is valid for all of us is using |
@fabianmoronzirfas Clear and good! Works for me, can't give more feedback before I started to document something! |
Really cool!
Yes, we still need to decide how to describe function arguments that can take different roles, depending on how you use the function. Example |
I would say like this? /**
* Creates a new RGB or CMYK color and adds the new color to the document, or gets a color by name from the document. The default color mode is RGB.
*
* @cat Color
* @method color
* @param {String|Number} [a] Get color by name if you add a string or create grey colr by number.
* @param {String|Number} [b] Depends on primary argument. If a is a Number and b is a String it is the name of the created color. If it is also a Number it is the intensity of Key added to a color.
* @param {String|Number} [c] and so on
* @param {String|Number} [d]
* @param {String|Number} [e]
* @return {Color} found or new color
*/
pub.color = function() { A lot of it depends on the description. The function description should already contain how the values are used. |
Some questions: 1What type do I write down for a /**
* @cat Document
* @subcat Primitives
* @method beginShape
* @param shapeMode Set b.CLOSE if the new Path should be auto-closed.
*/ To what should the So what do I write there? 2Should we change the descriptions to always be in one line only? 3Should I create separate PR's for A) making everything consistent and B) improve the descriptions themeselves? Or should this both be put in the same PR? |
About 1: I would say string… /**
* @cat Document
* @subcat Primitives
* @method beginShape
* @param {String} shapeMode Set b.CLOSE if the new Path should be auto-closed.
*/ About 2: I would say no. We can have multiline descriptions even with HTML to emphasize things. About 3: I would say make one PR for one "walkthrough" of a file. No need for to many PRs |
BTW we can have also code snippets directly in the code. See https://basiljs.github.io/#stories Looks pretty good. |
4From the Wiki:
Should this also be the case for return values? 5What type do I write down for a |
About 4: Return values have no variable name but a description. Should also be a sentence. About 5: You can write |
I just checked, technically it would result in a list of 47 different types of page items. I think I'll just use |
😬👌🏽 |
I noted something else. Some of the optional values have in their description an The problem I see there is that if it is forgotten (see https://basiljs.github.io/#stories) and I don't mark them automatically we loose something. If we force to write in every description the |
Sure, let's take it out. I just checked the files that I was assigned to, they all seem fine as they are. |
Great docs progress + wiki! Starting to work on color doc and ran into this tricky bastard.. I started looking at Processing/P5js/processingjs – and noticed they all use a 'syntax' section instead of params in the function name. Our quasi-merged method seems fine except on ones like b.color() + b.fill(), due to the variations:
Continuing from your example above, it might be something like the following:
– but that's still pretty abstract. Far from suggesting any major mod of docs per function, I'm wondering if the smoothest way to deal with this issue is leaving a basic param in the function like it was |
I like that suggestion and also agree, that describing each variation in the parameters themselves is too abstract and confusing. Showing the possible combinations of parameters is much more helpful. The p5.js documentation does something similar and I find it very clear. |
Yes it is a bit abstract. I still would prefer having it the same way as the rest of the docs and not creating a exception. You can add examples to make it clearer. |
While going through the result of the output of documentation.js and comparing it to the comments I found some inconsistencies in the comments we need to fix. For example there are some comments where a return value is an Array of things. Written like this:
In other cases it is just:
we got some:
Which are (I guess todo for a long time)
There should be an combined effort to review the comments on functions. Maybe by assigning files to contributor. Also we should write down/define how a new function should be documented.
The text was updated successfully, but these errors were encountered: