Skip to content

Commit bad6762

Browse files
Updated codeblock styling documentation with new theme options (#1252)
* Update settings.mdx * Update code.mdx * Update components/code-groups.mdx * Update settings.mdx * Update code.mdx * Update components/code-groups.mdx * Update settings.mdx * Update code.mdx * Update components/code-groups.mdx * copy edits --------- Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> Co-authored-by: Ethan Palm <[email protected]>
1 parent ca15642 commit bad6762

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

code.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ Enable syntax highlighting by specifying the programming language after the open
5959

6060
We use [Shiki](https://shiki.style/) for syntax highlighting and support all available languages. See the full list of [languages](https://shiki.style/languages) in Shiki's documentation.
6161

62+
Customize code block themes globally using `styling.codeblocks` in your `docs.json` file. Set simple themes like `system` or `dark`, or configure custom [Shiki themes](https://shiki.style/themes) for light and dark modes. See [Settings](/settings#styling) for detailed configuration options.
63+
6264
```java
6365
class HelloWorld {
6466
public static void main(String[] args) {

components/code-groups.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class HelloWorld {
2626

2727
</CodeGroup>
2828

29+
Code groups inherit global styling from your `docs.json` file. Customize your theme using `styling.codeblocks`. See [Settings](/settings#styling) for configuration options.
30+
2931
## Creating code groups
3032

3133
To create a code group, wrap multiple code blocks with `<CodeGroup>` tags. Each code block must include a title, which becomes the tab label.

settings.mdx

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,52 @@ See [Themes](themes) for more information.
127127
<ResponseField name="eyebrows" type="&quot;section&quot; | &quot;breadcrumbs&quot;">
128128
The style of the page eyebrow. Choose `section` to show the section name or `breadcrumbs` to show the full navigation path. Defaults to `section`.
129129
</ResponseField>
130-
<ResponseField name="codeblocks" type="&quot;system&quot; | &quot;dark&quot;">
131-
The theme of the code blocks. Choose `system` to match the site theme or `dark` for always dark code blocks. Defaults to `system`.
130+
<ResponseField name="codeblocks" type="&quot;system&quot; | &quot;dark&quot; | object">
131+
Code block theme configuration. Defaults to `"system"`.
132+
133+
**Simple options:**
134+
- `"system"`: Match current site mode (light or dark)
135+
- `"dark"`: Always use dark mode
136+
137+
**Custom theme configuration:**
138+
Use an object to specify [Shiki themes](https://shiki.style/themes). Choose a single theme for both modes or separate themes for light and dark.
139+
140+
<Expandable title="codeblocks">
141+
<ResponseField name="theme" type="string">
142+
A single Shiki theme name to use for both light and dark modes.
143+
144+
```json
145+
"styling": {
146+
"codeblocks": {
147+
"theme": "dracula"
148+
}
149+
}
150+
```
151+
</ResponseField>
152+
153+
<ResponseField name="themes" type="object">
154+
Separate themes for light and dark modes.
155+
156+
<Expandable title="themes">
157+
<ResponseField name="light" type="string" required>
158+
A Shiki theme name for light mode.
159+
</ResponseField>
160+
<ResponseField name="dark" type="string" required>
161+
A Shiki theme name for dark mode.
162+
</ResponseField>
163+
```json
164+
"styling": {
165+
"codeblocks": {
166+
"themes": {
167+
"light": "github-light",
168+
"dark": "github-dark"
169+
}
170+
}
171+
}
172+
```
173+
</Expandable>
174+
</ResponseField>
175+
</Expandable>
132176
</ResponseField>
133177
</Expandable>
134178
</ResponseField>

0 commit comments

Comments
 (0)