-
Notifications
You must be signed in to change notification settings - Fork 3
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
api section syntax #3
Comments
I kinda like the blade API style
Looks like this:
|
I'm -1 for including this in standard-readme, just because I don't think we'll ever be able to reach consensus. I think coming to some agreement on the rough outline (section headers, etc) of a readme would be enough of a step forward. |
But it also causes the biggest headaches all the time. Personally I don't want to regulate all API documentation, but the one existing in the readme. On the other hand |
I think https://github.com/jonschlinkert/micromatch and https://github.com/jonschlinkert/utils are also generated with verb, without any hand work. |
I agree with @zcei. Having consistency is more important than reaching consensus, I believe that is the same philosophy that drove I'm quite fond of how
So far I've yet to see any good documentation generators, most generators seem to generate documentation for machines, not humans. I find the docs for |
Mm yea, not good example. But |
I like the idea of using a
blade.compile: (bladeTemplate:String[, options], cb) => voidCompiles a Blade template from a string.
Example: blade.compile('h1 foo\n\t| sum text', function(err, html) {
console.log(err || html);
}); |
Worth noting: not all modules that will use |
A try to revive: I've been quiet for a long time, but the issue still bothers me. What I recently found is They are clearly intended for developers, but still it would be able to parse a decent documentation for trickier projects. And finally: Yes, I know it's a dev draft, but think it's the same as this project: It deserved to be pushed forward :) |
Cool, @zcei. I was wondering, are there already actionable points for this? I may be able to work on this but I'm not yet sure what's decided. |
As the We basically need some tooling to ensure that the function signatures are syntactically correct. In terms of "what's decided" I would wait for @fibo to bring up his arguments (he opened #5, because he wrote an article about tiny packages and we have a good overlapping in the readme part) If he can't convince me, I will decide for |
Something that matches with dox would be nice API
|
@api |
private | |
@param {String} |
bar | Lorem ipsum digitorum |
@returns {Number} |
count |
Follows the markdown code
## API
<a name="foo"></a>
### `foo(bar)`
> get the bar count
If you want to know the bar count you should use this function.
```
var countBars = foo(bar)
console.log(countBars) // 12
```
||||
---|---|---|
|`@api`|**private**|
|`@param {String}`|bar| Lorem ipsum digitorum
|`@returns {Number}`|count|
Oh, darn, I see I posted this here, this should’ve been #1 (regarding the if anything/section is already decided). Regarding API syntax, I’d opt for the third example mentioned above (from2), with the following reasoning:
# b.plugin([plugin], opts)
[plugin]: http://example.com Yields: b.plugin(plugin, opts)Thus, escaping of # `b.plugin([plugin], opts)`
[plugin]: http://example.com Yields the, in my opinion, great looking:
|
What about @jonschlinkert's readme styles? I mean, we almost all use jsdoc and it is easy to parse and already have good tools for parsing and outputing good documentation. There's a lot of examples, he have 1000+ npm packages and huge amount of github repos and projects which already use almost completely finished tools for doing the job and do it great. That's why he is big name in our community and there's no point against that. https://github.com/node-base/base#api Why we should use jsdoc? Because it leads to good and enough in-source documentation docblock comments from which can be generated good human documentation and readmes/sites. I can't think for better documentation than that (for example) source doc / human doc - it have and says everything, and give answers to many questions - what are the params, what are their types, description of the method, description of every param, and optionally you can add little example in the source code. JSDoc is perfect for code documenting. Those tags are not superfluous. And no, this isn't promotion of Jon Schlinkert and his tools and packages. For me, it is the best way to do the job and have perfect balance between well-formated source code comments and human-readable, human-understandable and easy api and documentation. Btw, shown examples are useful only for one type of humans - users, users which just will use the given package, but not the developers, not those people that read and contribute to the code. And one of the greatest things about tools created by and used by Jon is that all documentation is linked (out of the box) - it remainds me to "two-way data-binding" -- for README to source and source to README. Standards. Standards should be FROM anyone, not from few people in the community and their prefs and styles. Yea, they also are big and valuable community members. And the reason that I'm strongly behind Jon's style is that his tools use JSDoc and there's a lot more people that use JSDoc, then few devs that invent new style documenting (in my mind popups @yoshuawuyts style, sorry man - i understand your documentation and source code comments, but i dont think that's the way :) ) Cheers, |
@tunnckoCore I don’t think whether or not JSDoc should be used is of interest to The reason I later mentioned JSDoc, was because the example provided above (dox, generated from JSDoc) was pretty verbose, e.g., including Note: I love JSDoc, I use it all the time and my code is literally littered with the stuff. Thanks for bringing up Jon’s repos, he sure has contributed a lot to the community, and he definitely has a very nice style of documenting stuff (plus he’s a great guy). However, it’s very customised to his liking (I haven’t seen much like it by other people). That’s fine, I have my own signature style too, but I’d like to opt for a more “standard” style for something which is called “standard-readme” and affiliated with “standard”. On a side node: we should think more about what the people using standard want / use, as a project called “standard-readme” is weird when “standard” people don’t like the enforced style. |
@wooorm I can agree with you. And yea, have reason in your last paragraph.
Yea, but they at least use jsdoc and it won't be hard to just use some tool all over their projects. Cheers, |
Regarding your last two points (and please don’t edit comments without stating what you changed) of #3 (comment):
And regarding your last #3 (comment), sure, but this project is called standard-readme and not sindre-readme or tj-readme 😉 |
I definitely didn't want to introduce For extensive documentation I also like JSDoc, but just not for "simple annotations" or, as said, function signatures. The |
Agreed regarding the size. In real usage (yes I’ve done research), API signatures start at level three, as a README has one major heading (name of project), a secondary heading named
|
Very nice outcome of your research, can just agree! I started extracting the consensus of #1 into In the meantime I'll check out some of your mentioned repositories to get a feeling how the API style behaves out in the wild. |
Okay, I’ll outline some actionable things soon in a separate issue. |
@wooorm : yes you are right, I think that
|
A readme is more than API documentation, it's metadata for and about a project. Oftentimes a readme contains everything BUT the API documentation - like when the docs are hosted on gh-pages. Any standard that the community backs should be much more focused on the overall sections, expected metadata, and readability of a readme. API documentation needs differ greatly from one project to the next, but the expected metadata will always be the same: "Who made this?", "What license?", "Where can I find more info?" I still remember when I started programming and saw things like After spending 15 years of my career in SEO/SEM, I tend to make decisions based on actual numbers and statistics, balanced with my own perspectives and experience. For documentation I lean towards things that are preferred by search engines, since no one will be reading your docs anyway if they don't know your project exists (statistically speaking, across all of my projects google is responsible for the majority of project visits. along the lines of 60% of total traffic on average). If you can also make your documentation approachable to new developers, or non-developers, then all the better. just my 2c |
With this argumentation, we can stop building an API section right away. There are always people not immediately grasping the intention of a syntax.
That's definitely a wise approach and I recommend keeping this up 😉 But for me, that's up to the documentation tools you're using. You have a huge project? Go on and parse your docs out of The API section should outline how to use the code. No one prevents you from having e.g. links to classes in it, which are described in the verbose part of your docs. For me it's a timely matter. You will always first look at a projects readme, before jumping into the docs. Plus there may be cases when an package has no parsed/hosted docs available. You would then need to get the source code and generate docs on your own. |
I unsubscribed from this issue but someone mentioned me, so here I am. I feel there's a silly amount of bikeshed going on in this project. Would-be syntaxes are discussed without a single line of code existing. Six months ago all the proposals, ideas and discussions fell dead and nothing usable was created. So what I propose everyone with an interest in some sort of standard readme does, is to go out, and make things. Concensus will never be reached, but at least there'll be tangible things out there that can be used and improved upon. Cheers.
|
That was mainly my fault and in no way related to the useful-ness of a standard readme.
won't make it any better. That's what we're doing for the last few years. Where is the standard? It seems the only thing everybody can agree on, is that a readme is needed.. And absolute consensus is definitely unreachable, but I don't see why this should be an argument to not even try gaining an overview of preferences..
|
@yoshuawuyts from your response it sounds like maybe I came across in a way I didn't intend. If so please accept my apologies. I like this idea, and I was hoping to join the convo and thought it might be fun to help out. good luck! |
Don't worry, Jon, Yoshua's comment wasn't directed at you, rather, at the fact that 95% of the talk surrounding this project is about API section design (without any solutions). To a certain extend, I agree with Yoshua and I suggest taking API section syntax off the table. At least for now. And, instead, directing our work towards the other sections. |
originally posted in standard/standard#141 (comment)
Something that this module could additionally do is lint the way interfaces are defined in the API section. Everyone seems to do it differently, and having some consistency would be great. Just to display some of the flavors:
browserify
b.plugin(plugin, opts)
Register a
plugin
withopts
. Plugins can be a string module name or afunction the same as transforms.
plugin(b, opts)
is called with the browserify instanceb
.For more information, consult the plugins section below.
virtual-dom
Patch operations
Once we have computed the set of patches required to apply to the DOM, we need a function that can apply those patches. This is provided by the
patch
function. Given a DOM root node and a set of DOM patches, thepatch
function will update the DOM. After applying the patches to the DOM, the DOM should look like the newVTree
.from2
stream = from2.obj([opts], read)
Shorthand for
from2({ objectMode: true }, read)
.The text was updated successfully, but these errors were encountered: