feat(macros/DefaultAPISidebar): add Tutorial section #7646
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This adds support for multi-page tutorials to
DefaultAPISidebar
, which will enable us to get rid of two custom sidebar macros: CanvasSidebar and WebGLSidebar.Problem
Almost all pages in Web/API use one of two sidebars:
DefaultAPISidebar
for API overviews and guides, andAPIRef
for everything else. However there are four custom sidebars which exist only for a single API each.Two of the custom sidebars are CanvasSidebar and WebGLSidebar. I would like these custom sidebars to be retired, and for us only to use the normal ones. However, these sidebars have one feature which we can't currently support in
DefaultAPISidebar
: a multi-page tutorial:This is distinct from single-page guides and should not be dumped in there.
Solution
This PR adds a feature to
DefaultAPISidebar
that looks for a"tutorial"
key in GroupData, that is expected to contain a multi-page tutorial given in reading order. IfDefaultAPISidebar
finds one of these it renders a "Tutorial" section in the sidebar.This PR doesn't have a hard dependency on mdn/content: it can be merged without any corresponding mdn/content PR and should not break anything.
However, to see the "Tutorial" section it will need an mdn/content update. I've pushed an update to https://github.com/wbamberg/content/tree/use-defaultapisidebar-tutorials so you can see it working. The mdn/content update does three things:
If this PR is accepted I will update all the WebGL and Canvas docs to use DefaultAPISidebar, then deprecate their custom sidebars.
Screenshots
Before
After
How did you test this change?