Skip to content

Commit

Permalink
[Docs Site] Add collapsible plugin to code blocks (#19041)
Browse files Browse the repository at this point in the history
  • Loading branch information
KianNH authored Jan 7, 2025
1 parent 5fc650b commit 1603a96
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ec.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import lightTheme from "solarflare-theme/themes/cloudflare-light-color-theme.jso
import { definePlugin } from "@expressive-code/core";
import { h } from "@expressive-code/core/hast";

import { pluginCollapsibleSections } from "@expressive-code/plugin-collapsible-sections";

import lzstring from "lz-string";

/**
Expand Down Expand Up @@ -156,6 +158,7 @@ export default {
workersPlaygroundButton(),
outputCodeblocks(),
defaultLanguageTitles(),
pluginCollapsibleSections(),
],
themes: [darkTheme, lightTheme],
styleOverrides: {
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@cloudflare/vitest-pool-workers": "^0.5.40",
"@cloudflare/workers-types": "^4.20241218.0",
"@codingheads/sticky-header": "^1.0.2",
"@expressive-code/plugin-collapsible-sections": "^0.38.3",
"@iarna/toml": "^2.2.5",
"@iconify-json/material-symbols": "^1.2.12",
"@stoplight/json-schema-tree": "^4.0.0",
Expand Down
9 changes: 9 additions & 0 deletions src/content/docs/style-guide/components/code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ This is just a small showcase of functionality, it has a lot of options!
Write-Output "This one has a title!"
```

```js collapse={3-5}
// Collapsing
const foo = {
1: 1,
2: 2,
3: 3,
};
```

```js wrap
// Example with wrap
function getLongString() {
Expand Down

0 comments on commit 1603a96

Please sign in to comment.