-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Discussion(doc,tools): Include file source text into Markdown files #32916
Comments
Is there currently a way to add extensions to Node docs?
|
The markdown docs are processed by the code in |
One downside to this approach is that it further degrades the experience of browsing the markdown files on GitHub. Not necessarily a deal-breaker, but the upside should outweigh the downside. |
@DerekNonGeneric The code samples in the Markdown files are linted already. For example, in
Is there a particular problem/rule that needs to be added to the linting? You can see the modifications to our base |
Just left a comment at #32646 (comment) but probably worth repeating it here in case there is a need for more rigorous checking than linting provides: For addons.md, we have code that extracts the code samples and makes sure they all compile. Perhaps we could do something similar for esm.md? |
Wow, we have some good talking points so far. Thanks for looking into this! /re @Trott's comments
Quick recap of options that may solve for my particular use case: A. extend Markdown — #32916 (comment) Note: option A would be representative of a feature request if this really were one. |
I maintain the CoffeeScript docs, and in those I took the “extend Markdown” approach: a code block that starts with
To be honest this hadn’t occurred to me for my implementation, but I see why it would be a concern. One thing I’ve noticed is that you can have relative links in Markdown, so a potential solution is to include a relative link to the code file in the Markdown itself, and possibly hide it in the HTML version (or exclude it from the output). Something like:
Where |
There appears to be no simple answer and it may be entirely possible that all three of these options would need to be used in conjunction to accomplish the ideal:
Some of it is handled via ESLint plugin, so I think for our own sake, we should start there while leaving the rest of the options on the table. |
This comment has been minimized.
This comment has been minimized.
@nodejs/linting |
I'm not familiar with the jsdoc plugin rules, so I honestly don't know, but I suppose you could try enabling that in |
Also, relevant comment in #32913 (comment). Apparently, the N-API team would find it useful to maintain a particular markdown table outside of the N-API markdown doc itself. (The idea is for that to make it easier to keep the table up to date across release lines, which I would guess has to do with ease of cherry-picking and not having to manually backport stuff due to conflicts, but I'm not actually 100% sure.) |
I saw that and didn't want to derail this discussion with anything regarding talking point no. 4. I'm planning to open something more focused on that one. ;) Glad to hear more feedback may be on the way! Git's precedent may help justify their case—for example: Included file source text: https://github.com/git/git/blob/master/Documentation/trace2-target-values.txt |
This may have been overlooked and clarity on whether the Markdown files in the
Specs: |
I think what you're describing is as it should be, certainly. If there are places where it's not, that's probably more because someone forgot (and we're not linting carefully enough). |
Hi Folks, Thanks for your participation! We've reached a conclusion, so I'm closing this thread as an indication of that. If further discussion would've been desirable (or anything was left unsaid), feel free to continue the conversation here or check out doc/guides/contributing/issues.md for guidance on opening new issues for discussion. :) |
Is your feature request related to a problem? Please describe.
Problem space: There does not appear to be a way to embed the source text of a local file into the Markdown files of the API docs.
Context: I'm trying to include a JS code sample in API docs Markdown that would exist in a different file. It would be preferable if it could pass a few validation & lint-style checks prior to being embedded and disseminated. I mentioned the desire for this in a previous comment, which follows.
After further thought and a new PR, re-implementation of this test fixture (presently inert & obsoleted), re-purposing it, and re-integrating it as a code sample supporting the prose of a new loader example seems most logical. However, as @devsnek pointed out, code samples intended for docs shouldn't exist in
test/
(withdoc/
potentially being more appropriate as an idea fielded on IRC).Describe the solution you'd like
After a cursory look, @Trott and myself are under the impression that the documentation generator (
tools/doc/
) is not presently capable of performing this feature and it was suggested that there may be value in opening an issue for discussion.Therefore, (pointed out to me by @Trott) this is solvable in a number of different ways as is apparent in the following StackOverflow question and may benefit from discussion.
https://stackoverflow.com/questions/4779582/markdown-and-including-multiple-files
Any thoughts/suggestions are welcome and would be highly appreciated! :)
/cc @rubys and @vsemozhetbyt as have been relevant prior contributors to
tools/doc/
/cc @wooorm as has been helpful with previous @unifiedjs tooling workflows
/cc @GeoffreyBooth as is likely interested in the discussion and outcome
/cc @nodejs/documentation as would likely be the relevant team
The text was updated successfully, but these errors were encountered: