Skip to content

feat(daffio, docs): enable rendering of example code output in design docs#4274

Merged
xelaint merged 28 commits intodevelopfrom
design-examples-overhaul
Mar 2, 2026
Merged

feat(daffio, docs): enable rendering of example code output in design docs#4274
xelaint merged 28 commits intodevelopfrom
design-examples-overhaul

Conversation

@damienwebdev
Copy link
Member

@damienwebdev damienwebdev commented Jan 6, 2026

PR Checklist

  • Commit message follows our contributing guidelines
  • Tests added/updated (for bug fixes/features)
  • Documentation added/updated (for bug fixes/features)

PR Type

  • Bug fix
  • Feature
  • Style update
  • Refactor
  • Test
  • Build
  • CI
  • Docs
  • Performance
  • Other (please describe)

Current behavior

We have no way to render code output inside of markdown content in daff.io.

Fixes: #2903, fixes: #2905

New behavior

We can now render design examples (as well as other examples) in daff.io

Breaking change?

  • Yes
  • No

Additional context

This supersedes

@damienwebdev damienwebdev requested review from a team as code owners January 6, 2026 14:44
@damienwebdev damienwebdev force-pushed the design-examples-overhaul branch from 40580f1 to f9b8f3e Compare January 6, 2026 14:48
@damienwebdev damienwebdev force-pushed the design-examples-overhaul branch from f9b8f3e to 706055a Compare January 6, 2026 15:22
@xelaint xelaint force-pushed the design-examples-overhaul branch 2 times, most recently from ac0dd61 to 9b093a1 Compare January 7, 2026 15:28
@xelaint xelaint requested a review from a team as a code owner January 7, 2026 15:28
@damienwebdev
Copy link
Member Author

damienwebdev commented Jan 7, 2026

TODO:

  • Find all existing readme files with a design-land-example and make them work
  • Make initial render of the example viewer work on design components (daff-tabs interaction)
  • Make files for design-examples load
  • Add a mode for "simple" examples like color palette guides.

griest024
griest024 previously approved these changes Feb 19, 2026
@griest024 griest024 dismissed their stale review February 19, 2026 22:43

still TODOs

@griest024 griest024 self-assigned this Feb 19, 2026
@griest024
Copy link
Member

@damienwebdev

Make initial render of the example viewer work on design components (daff-tabs interaction)

Does this refer to SSR?

@griest024
Copy link
Member

There's still a slight render issue of the example previews in SSR but I don't think that should block this PR. I think we should piece this up and merge it.

@xelaint
Copy link
Member

xelaint commented Feb 24, 2026

@griest024 the color palette example is not visible on /docs/design/foundations/color

@griest024
Copy link
Member

@griest024 the color palette example is not visible on /docs/design/foundations/color

@xelaint good catch, fixed

@xelaint
Copy link
Member

xelaint commented Feb 24, 2026

@griest024 Is there a way to prevent these from being displayed?

// Base colors
/// @access private
$white: #ffffff;
/// @access private
$black: #070707;
// need to deprecate
/// @access private
$error: #dd0000;

@griest024
Copy link
Member

griest024 commented Feb 24, 2026

@griest024 Is there a way to prevent these from being displayed?

// Base colors
/// @access private
$white: #ffffff;
/// @access private
$black: #070707;
// need to deprecate
/// @access private
$error: #dd0000;

There seem to be 3 options:

  1. if we only ever want to render maps, we can filter out vars that are just simple color values
  2. we can filter out specifically those variables by name, but that will have to be hardcoded in the component
  3. add a doc tag that will indicate the var should be excluded from either the docsgen or the rendering

@xelaint
Copy link
Member

xelaint commented Feb 25, 2026

@griest024 Is there a way to prevent these from being displayed?

// Base colors
/// @access private
$white: #ffffff;
/// @access private
$black: #070707;
// need to deprecate
/// @access private
$error: #dd0000;

There seem to be 3 options:

  1. if we only ever want to render maps, we can filter out vars that are just simple color values
  2. we can filter out specifically those variables by name, but that will have to be hardcoded in the component
  3. add a doc tag that will indicate the var should be excluded from either the docsgen or the rendering

Can be just remove the switch and case here to just display MAP?

@switch (palette.context.parsedValue.type) {
				@case (COLOR) {
					<div style="background-color: {{palette.context.parsedValue.parsed}};">
						<span class="daff-docs-color__hex">{{palette.context.parsedValue.raw}}</span>
						<span class="daff-docs-color__hue">{{palette.context.parsedValue.parsed}}</span>
					</div>
				}
				@case (MAP) {
					@if (palette.context.parsedValue.parsed) {
						@for (shade of palette.context.parsedValue.parsed | keyvalue | daffDocsPaletteShadeSort; track shade.key) {
							<div style="background-color: {{shade.value}};">
								<span class="daff-docs-color__hex">{{shade.key}}</span>
								<span class="daff-docs-color__hue">{{shade.value}}</span>
							</div>
						}
					}
				}
			}

@griest024
Copy link
Member

@xelaint yes, that's basically option 1. If you're sure that we'll only ever want to render maps, feel free to go ahead and make that change

@xelaint xelaint force-pushed the design-examples-overhaul branch from 56fb373 to 92e3d20 Compare February 25, 2026 18:46
@xelaint
Copy link
Member

xelaint commented Feb 25, 2026

@griest024 Done. Can you review? Should be good to merge if all looks good.

@xelaint xelaint added package: daff.io @daffodil/daff.io package: docs @daffodil/docs labels Mar 2, 2026
@xelaint xelaint changed the title feat(daffio): enable rendering of example code output in daffio feat(daffio, docs): enable rendering of example code output in daffio Mar 2, 2026
@xelaint xelaint changed the title feat(daffio, docs): enable rendering of example code output in daffio feat(daffio, docs): enable rendering of example code output in design docs Mar 2, 2026
@xelaint xelaint merged commit 4c88b0f into develop Mar 2, 2026
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: daff.io @daffodil/daff.io package: docs @daffodil/docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daffodil Palette Docs Generation [FEAT] Display Example Viewer in Markdown Files

3 participants