Skip to content

Commit 68f7414

Browse files
colbywhiteask-bonk[bot]mvvmmahaywood
authored
feat: add ai explain buttons to code block (#29533)
* feat: add ai explain buttons to code block * fix: load explain plugin into ec This somehow got lost during rebase. * fix: account for title bars in btn placement * feat: match copy btn style, DOM This allows for better theming and maintainability. * Fixed formatting, all checks pass, LGTM Co-authored-by: mvvmm <mvvmm@users.noreply.github.com> * 💄 Style adjustments for content width and the tooltip * ✨ Increased the height of the skeleton loader to closer match the content returned --------- Co-authored-by: ask-bonk[bot] <ask-bonk[bot]@users.noreply.github.com> Co-authored-by: mvvmm <mvvmm@users.noreply.github.com> Co-authored-by: Amy Haywood Dutton <adutton@cloudflare.com>
1 parent 110b860 commit 68f7414

15 files changed

Lines changed: 3960 additions & 276 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ yarn-error.log*
2525
pnpm-debug.log*
2626

2727
# environment variables
28-
.env
28+
.env*
2929
.env.production
3030

3131
# macOS-specific files

‎AGENTS.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,20 @@ Tests use Vitest with three workspace projects (`vitest.workspace.ts`):
352352

353353
Run all tests: `npm run test`
354354

355+
## Web components
356+
357+
New web components in this codebase should use the `cfdocs-` prefix for custom element names (e.g., `<cfdocs-sheet>`, `<cfdocs-explain-code>`). This establishes a consistent naming pattern going forward.
358+
359+
### Naming conventions
360+
361+
- **Custom element names**: Use kebab-case with `cfdocs-` prefix (e.g., `cfdocs-sheet`)
362+
- **Class names**: Use PascalCase with `Element` suffix (e.g., `SheetElement`, `ExplainCodeElement`)
363+
- **File locations**: Place components in `src/components/{component-name}/` directories
364+
365+
### Existing components
366+
367+
Existing components (`warp-download`, `stream-player`, `rule-id`, `check-box`, `r2-local-uploads-diagram`, `animated-workflow-diagram`, `autoconfig-diagram`) are exempt from the `cfdocs-` prefix requirement and do not need to be renamed.
368+
355369
## Commit conventions
356370

357371
- Format: `[Product] description` or `type: description`

‎ec.config.mjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import pluginWorkersPlayground from "./src/plugins/expressive-code/workers-playg
88
import pluginOutputFrame from "./src/plugins/expressive-code/output-frame.js";
99
import pluginDefaultTitles from "./src/plugins/expressive-code/default-titles.js";
1010
import pluginGraphqlApiExplorer from "./src/plugins/expressive-code/graphql-api-explorer.js";
11+
import pluginExplainCode from "./src/plugins/expressive-code/explain-code.js";
1112

1213
import { pluginCollapsibleSections } from "@expressive-code/plugin-collapsible-sections";
1314
import { pluginLineNumbers } from "@expressive-code/plugin-line-numbers";
@@ -20,6 +21,7 @@ export default defineEcConfig({
2021
pluginCollapsibleSections(),
2122
pluginGraphqlApiExplorer(),
2223
pluginLineNumbers(),
24+
pluginExplainCode(),
2325
],
2426
defaultProps: {
2527
showLineNumbers: false,

0 commit comments

Comments
 (0)