From a07705ab7cb3b9932e14a3a0b2c67ff8265df211 Mon Sep 17 00:00:00 2001 From: "ccf-factory[bot]" Date: Fri, 27 Nov 2026 19:59:20 +0000 Subject: [PATCH 1/4] feat(tutorials): showcase the tutorial components and document how to write tutorials Adds docs/tutorials/components.mdx, the one showcase page that renders every code block and MDX component from the two preceding pull requests, each with a usage snippet; registers it in tutorialsSidebar; adds the Tutorials page skeleton to STYLE.md; and tells authors where tutorials live in CONTRIBUTING.md. --- CONTRIBUTING.md | 6 + STYLE.md | 19 +++ docs/tutorials/components.mdx | 299 ++++++++++++++++++++++++++++++++++ sidebars.js | 2 +- 4 files changed, 325 insertions(+), 1 deletion(-) create mode 100644 docs/tutorials/components.mdx diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0eefd2f..d00d482 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,6 +78,12 @@ A plugin's policy bundles are the ones its `policies` list in `instances.yaml` n Release docs (notes, API reference, configuration reference, feature and upgrade guides, catalog rows and version cuts) are mostly written by the factory when a release ships. You can still open a pull request for any of them. +## Writing tutorials + +Tutorials are hands-on walks through a task, in `docs/tutorials/`. They are general pages like the introduction and the glossary: not versioned, served under the **Tutorials** tab. The sidebar is `tutorialsSidebar` in `sidebars.js`: add your page's id there, or it builds but stays out of the navigation. + +Write a tutorial to the [tutorials page](STYLE.md#tutorials-page) skeleton in STYLE.md. Use the MDX components the tutorials are built from rather than raw HTML: they are showcased, rendering live with a usage snippet for each, in [docs/tutorials/components.mdx](docs/tutorials/components.mdx), and registered on every page's MDX scope, so no tutorial imports them. + ## Pull requests 1. Branch from `main` and keep each pull request to one change: one release, one fix or one new page. diff --git a/STYLE.md b/STYLE.md index dde5299..b726ce7 100644 --- a/STYLE.md +++ b/STYLE.md @@ -80,6 +80,25 @@ Mark a setting added in this line with *(new in 0.21)* in its Purpose cell, and ## Related ``` +### Tutorials page + +One hands-on walk through a task, in `docs/tutorials/` (the **Tutorials** tab). It starts from a clean state and ends with a result the reader can inspect in the UI. Use the tutorial components (showcased in `docs/tutorials/components.mdx`) instead of raw HTML: `Steps` for the stages, `CopyBlock` for commands and files, `CodeGroup` when a step has more than one file, `Tabs` for variants of one step, the callouts for caveats and `Accordion` for details only some readers need. + +```md +# + + + +## Before you start + +## + +## Check your work + +## Next steps + +``` + ### Upgrade guide For minor and major releases. One page per target line, for example "Upgrade to 0.21". diff --git a/docs/tutorials/components.mdx b/docs/tutorials/components.mdx new file mode 100644 index 0000000..9c9f10a --- /dev/null +++ b/docs/tutorials/components.mdx @@ -0,0 +1,299 @@ +--- +sidebar_label: Components +description: Every code block and MDX component a tutorial page can use, rendering live, each with the snippet that produced it. +--- + +# Tutorial components + +This page is for docs authors. Every block a tutorial can use is here, rendering live so you can click through it, each with the snippet that produced it. Copy a snippet into your page and change the words. Nothing needs an import: `src/theme/MDXComponents/index.tsx` registers all of them on the MDX scope of every page. + +Start a new tutorial from the [Tutorials overview](./index.md) and follow the **Tutorials page** skeleton in `STYLE.md`. The component sources are in `src/components/tutorials/`; each file's header comment says what the component is for and which `yarn test` cases cover its logic. + +## CopyBlock + +One snippet the reader copies in one click: a command, a config file or file contents, with a title row and a copy button that stays visible. Pass the snippet as the `code` prop, or as text children (a template literal that spans several lines); shared leading indentation is dropped, so it copies exactly what the reader sees. `language` picks the highlighting (`sh`, `yaml`, `json`, ...) and `title` labels the block. + + + {`yarn build`} + + +```mdx title="Usage" + + {`yarn build`} + +``` + +## CodeGroup + +The files of one step, shown as tabs so the page stays short. The reader opens the file they need, and each tab keeps its own copy button. `items` takes one `{title, code, language}` object per file; `defaultTab` names the tab to open first. + + + +```mdx title="Usage" + +``` + +## Tabs and Tab + +The variants of one step, shown as tabs: install with yarn or with npm, run on Ubuntu or on RHEL. The reader opens the one that matches their setup. `defaultTab` opens one first; the tab row moves with the arrow keys and jumps to either end with **Home** and **End**. Each `` carries a `title` and its content. + + + + + + + + + + + + + + +```mdx title="Usage" + + + + + + + + + + + + +``` + +## Card and CardGroup + +A link shown as a clickable card: the "what to do next" at the end of a tutorial. An internal `href` starts with a single `/` and navigates in place; any other `href` opens in a new tab. `icon` is a short glyph before the title. `CardGroup` lays the cards in a grid; `cols` is how many columns a wide screen shows (1 to 4, default 2). + + + + + The tutorial groups and where to start. + + + + + What CCF does, for readers new to the framework. + + + + + Omit `href` for a card that only explains something. + + + + +```mdx title="Usage" + + + + The tutorial groups and where to start. + + + + + What CCF does, for readers new to the framework. + + + +``` + +## Steps and Step + +A task broken into numbered stages, read top to bottom: the circle numbers each step and the line joins them, so the reader sees how far they have come. A step's content is ordinary Markdown, so it can hold commands, prose or a callout. + + + + + Run the build from the repo root: + + + + + + + Serve the built site locally. + + + + + + +```mdx title="Usage" + + + + Run the build from the repo root: + + + + + + + Serve the built site locally. + + + + + +``` + +## Callout, Note, Tip, Info, Warning and Danger + +The notes a tutorial makes beside its steps. The type picks the accent color and the icon; the five types follow the admonitions Docusaurus itself ships. `title` adds a bold line before the text. ``, ``, ``, `` and `` are `` with the type already set. + + + +Tutorials are unversioned: they document the current release. + + + + + +Pass `defaultOpen` to an Accordion when most readers need the detail inside it. + + + + + +Every component on this page is registered on the MDX scope, so no tutorial page imports it. + + + + + +The build checks relative Markdown links and fails on a broken one. Link `STYLE.md` by name from a tutorial, not as a relative link that leaves `docs/`. + + + + + +Never link a versioned page to `current`, the unreleased docs: link between instances to a released version line. + + + +```mdx title="Usage" + + +Tutorials are unversioned: they document the current release. + + + + + +The build checks relative Markdown links and fails on a broken one. + + + + + +The long form, when you pass `type` yourself: `note`, `tip`, `info`, `warning` or `danger`. + + +``` + +## Accordion and AccordionGroup + +A question or a detail the reader opens only when they need it: what a flag does, what the output looks like. Each item is a native `details` element, so it works before the page's scripts load; `defaultOpen` starts one open. `AccordionGroup` joins several items into one bordered list. + + + + + So the item opens and closes before the page's scripts load, with no state to manage. + + + + + Yes: its content is ordinary Markdown, so it can hold a CopyBlock, a table or a callout. + + + + +```mdx title="Usage" + + + + So the item opens and closes before the page's scripts load, with no state to manage. + + + + + Yes: its content is ordinary Markdown, so it can hold a CopyBlock, a table or a callout. + + + +``` + +## Combine them + +The components nest, so one step can hold everything the reader needs: a stage of a `Steps` list with its command in a `CodeGroup`, a caveat in a `Warning` and the longer explanation in an `Accordion`. + + + + + Open `sidebars.js` and add the page's id to `tutorialsSidebar`, after the page that should precede it: + + + + + + A doc id is the file's path under `docs/` without the extension. A wrong one fails the build. + + + + + + Run `yarn build`: it reports the ids it can't resolve. + + + + + + +```mdx title="Usage" + + + + Open `sidebars.js` and add the page's id to `tutorialsSidebar`: + + + + + + A doc id is the file's path under `docs/` without the extension. + + + + + +``` + +## Related + +- [Tutorials overview](./index.md): the tutorial groups and where a new tutorial belongs. +- `STYLE.md`: voice, the **Tutorials page** skeleton, media and links. +- `CONTRIBUTING.md`: where tutorials live and how a docs pull request is reviewed. diff --git a/sidebars.js b/sidebars.js index 839faa2..bc142d6 100644 --- a/sidebars.js +++ b/sidebars.js @@ -33,7 +33,7 @@ const sidebars = { // Curated by hand; the navbar "Tutorials" item links to this sidebar // (see the docSidebar item in docusaurus.config.ts). - tutorialsSidebar: ['tutorials/index'], + tutorialsSidebar: ['tutorials/index', 'tutorials/components'], }; module.exports = sidebars; From d11a2cd90cc8314b069816f2170cc942dbc8453c Mon Sep 17 00:00:00 2001 From: "ccf-factory[bot]" Date: Fri, 27 Nov 2026 20:02:22 +0000 Subject: [PATCH 2/4] self-review: address pass 1 findings Name the product in full on first use of the showcase page, and make the Card and Combine-them usage snippets byte-match the live demo they show. --- docs/tutorials/components.mdx | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/docs/tutorials/components.mdx b/docs/tutorials/components.mdx index 9c9f10a..6a5f157 100644 --- a/docs/tutorials/components.mdx +++ b/docs/tutorials/components.mdx @@ -89,7 +89,7 @@ A link shown as a clickable card: the "what to do next" at the end of a tutorial - What CCF does, for readers new to the framework. + What the Continuous Compliance Framework (CCF) does, for readers new to it. @@ -108,7 +108,12 @@ A link shown as a clickable card: the "what to do next" at the end of a tutorial - What CCF does, for readers new to the framework. + What the Continuous Compliance Framework (CCF) does, for readers new to it. + + + + + Omit `href` for a card that only explains something. @@ -278,16 +283,30 @@ The components nest, so one step can hold everything the reader needs: a stage o - Open `sidebars.js` and add the page's id to `tutorialsSidebar`: + Open `sidebars.js` and add the page's id to `tutorialsSidebar`, after the page that should precede it: - + - A doc id is the file's path under `docs/` without the extension. + A doc id is the file's path under `docs/` without the extension. A wrong one fails the build. + + + Run `yarn build`: it reports the ids it can't resolve. + + + ``` From d7f1dcfeaafa72271e28cd849df4851f7fe02240 Mon Sep 17 00:00:00 2001 From: "ccf-factory[bot]" Date: Fri, 27 Nov 2026 20:03:30 +0000 Subject: [PATCH 3/4] self-review: address pass 2 findings The yarn test claim holds for the plain helpers, not every component file. --- docs/tutorials/components.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/components.mdx b/docs/tutorials/components.mdx index 6a5f157..17c23a0 100644 --- a/docs/tutorials/components.mdx +++ b/docs/tutorials/components.mdx @@ -7,7 +7,7 @@ description: Every code block and MDX component a tutorial page can use, renderi This page is for docs authors. Every block a tutorial can use is here, rendering live so you can click through it, each with the snippet that produced it. Copy a snippet into your page and change the words. Nothing needs an import: `src/theme/MDXComponents/index.tsx` registers all of them on the MDX scope of every page. -Start a new tutorial from the [Tutorials overview](./index.md) and follow the **Tutorials page** skeleton in `STYLE.md`. The component sources are in `src/components/tutorials/`; each file's header comment says what the component is for and which `yarn test` cases cover its logic. +Start a new tutorial from the [Tutorials overview](./index.md) and follow the **Tutorials page** skeleton in `STYLE.md`. The component sources are in `src/components/tutorials/`; each file's header comment says what the component is for, and the plain helpers next to them have `yarn test` cases. ## CopyBlock From d248b297ca30cbf4624b04f77480906b01b0d80b Mon Sep 17 00:00:00 2001 From: "ccf-factory[bot]" Date: Fri, 27 Nov 2026 20:04:59 +0000 Subject: [PATCH 4/4] self-review: address pass 3 findings Render the five callout shorthands and the long-form Callout live, and make the Callout usage fence byte-match its live demo. --- docs/tutorials/components.mdx | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/docs/tutorials/components.mdx b/docs/tutorials/components.mdx index 17c23a0..8947e7d 100644 --- a/docs/tutorials/components.mdx +++ b/docs/tutorials/components.mdx @@ -193,6 +193,12 @@ Never link a versioned page to `current`, the unreleased docs: link between inst + + +Pass `type` yourself (`note`, `tip`, `info`, `warning` or `danger`) when you build the type in, for example from a page's own data. + + + ```mdx title="Usage" @@ -200,15 +206,33 @@ Tutorials are unversioned: they document the current release. + + +Pass `defaultOpen` to an Accordion when most readers need the detail inside it. + + + + + +Every component on this page is registered on the MDX scope, so no tutorial page imports it. + + + -The build checks relative Markdown links and fails on a broken one. +The build checks relative Markdown links and fails on a broken one. Link `STYLE.md` by name from a tutorial, not as a relative link that leaves `docs/`. - + + +Never link a versioned page to `current`, the unreleased docs: link between instances to a released version line. + + + + -The long form, when you pass `type` yourself: `note`, `tip`, `info`, `warning` or `danger`. +Pass `type` yourself (`note`, `tip`, `info`, `warning` or `danger`) when you build the type in, for example from a page's own data. ```