Skip to content
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

Auto generate the map-like and set-like members #4

Open
captainbrosset opened this issue Jan 31, 2023 · 2 comments
Open

Auto generate the map-like and set-like members #4

captainbrosset opened this issue Jan 31, 2023 · 2 comments

Comments

@captainbrosset
Copy link

I am working on documenting the Highlight and HighlightRegistry interfaces on MDN right now (see mdn/content#23907).

Highlight is a Set-like object, and HighlightRegistry is a Map-like object. This means that, even if the spec doesn't mention it, they both have a size property, and many methods like set, add, clear, delete, etc. that need to be documented on MDN too.

A case could be made for MDN to handle this automatically. But I think it's better to actually write the entire doc again, rather than inherit from the Set and Map docs on MDN, because even if some objects are "like" Sets or Maps, it makes sense to document them in the context of their own parent API, with specific examples and so on.

So, I believe this scaffolding tool should generate the Set-like and Map-like members (methods and properties).

@dontcallmedom
Copy link
Owner

@captainbrosset do you have example of pages that illustrate this pattern?

Generally speaking, I think we should discuss these patterns and their impact on page type templates in the mdn/content repo, and once the outcome becomes clear, then it can be reflected in the templates this tool uses.

(I've already starting making up patterns e.g. for overloaded operations based on what I've seen MDN pages do, but a more structured approach would deliver more useful results :)

@captainbrosset
Copy link
Author

This PR preview page illustrates the pattern: https://pr23907.content.dev.mdn.mozit.cloud/en-US/docs/Web/API/Highlight/Highlight

The sidebar on this page shows the size property, and the add, clear, delete, entries, forEach, has, keys, and values methods which aren't spec'd on https://w3c.github.io/csswg-drafts/css-highlight-api-1/#highlight other than by saying that the Highlight interface is a setlike<AbstractRange>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants