Draft: DocsDrawers PoC
What does this MR do and why?
This is a PoC to include docs drawers in the product. Some of the code here is inspired by !82516 (closed).
Screenshots or screen recordings
Advanced Search Syntax | GLFM (dummy drawer for this PoC only) |
---|---|
![]() |
![]() |
Screen recording |
---|
docs_drawer |
How to set up and validate locally
To view the drawers implemented in this MR
- In the top navbar, search for any text.
- On the next page, click on the
Advanced search syntax
orGitLab Flavored Markdown
button.
To add a new docs drawer
- Create a Markdown file in the
doc/drawers
directory. - In
app/assets/javascripts/docs_drawer/constants.js
, add a an entry to theDOCS_DRAWERS
map.- The new key should correspond to the Markdown file's path you've just created, relative to the
doc/drawers
directory and omitting the.md
extension. So, it you've createddoc/drawers/foo/bar.md
, the new key should be'foo/bar'
. - The value can be an empty object (
{}
), or you can provide options to the drawer (refer to the comment inapp/assets/javascripts/docs_drawer/constants.js
for more information on available options).
- The new key should correspond to the Markdown file's path you've just created, relative to the
- In the area where you want to add the docs drawer, import the
toggleDocsDrawer
helper:import { toggleDocsDrawer } from '~/docs_drawer';
- On the interaction that should trigger the docs drawer, call
toggleDocsDrawer
with the key you've added to theDOCS_DRAWERS
map earlier, eg:toggleDocsDrawer('foo/bar');
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #365287 (closed)
Edited by Paul Gascou-Vaillancourt