Skip to content

Commit 95c0f04

Browse files
fixes #82 (#91)
1 parent 8b8181c commit 95c0f04

File tree

2 files changed

+44
-11
lines changed

2 files changed

+44
-11
lines changed

src/content/docs/content/starlight.mdx

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Starlight components and misc
33
---
44

5+
import { Tabs, TabItem } from '@astrojs/starlight/components';
56
import { CodeBlock } from "@interledger/docs-design-system";
67

78
## Components
@@ -28,10 +29,6 @@ Code blocks in Markdown are fenced by three beginning and ending backticks (` ``
2829

2930
Hovering over a Starlight code block will display a copy button.
3031

31-
:::note
32-
As of November 29, 2023, this button will not appear when using the in-house [ChunkedSnippet](/oppm/chunkedsnippet) component. We're tracking the issue in https://github.com/interledger/open-payments/issues/384.
33-
:::
34-
3532
#### Syntax highlighting
3633

3734
You can indicate the programming language to use if you want to use syntax highlighting. Astro uses [Shiki](https://shiki.style/languages), so check their documentation if you aren't sure if your language is supported.
@@ -48,7 +45,7 @@ This code block has a title! HJ made the component. Isn't she neat?
4845

4946
</CodeBlock>
5047

51-
As of November 2023, Starlight now supports adding titles to code blocks; however, the title is styled to appear in a tab. Also, to use the Starlight title, you **must** specify a programming language.
48+
As of November 2023, Starlight now supports adding titles to code blocks, but the title is styled to appear in a tab. Also, to use the Starlight title, you **must** specify a programming language.
5249

5350
We've chosen to keep our in-house `CodeBlock` component because we like the style more. However, you are free to use the Starlight defaults if they fit better with what you're documenting.
5451

@@ -62,7 +59,7 @@ I mean, at least it works by default now, right?
6259
```
6360
````
6461
65-
By default, a Starlight code block will be rendered as a terminal window if a shell scripting language is used (e.g., `bash`, `shell`, `zsh`). Titles are styled differently in this context.
62+
By default, a Starlight code block will be rendered as a terminal window if a shell scripting language is used (for example, `bash`, `shell`, `zsh`). Titles are styled differently in this context.
6663
6764
For example:
6865
@@ -73,19 +70,54 @@ See what it looks like?
7370
See the [Frames and titles](https://starlight.astro.build/guides/authoring-content/#frames-and-titles) section in Starlight's docs for more information.
7471
7572
### Tabs
76-
<p>
77-
<mark>*This section needs to be added, along with info about tab synching.*</mark>
78-
</p>
73+
74+
You can keep multiple tab groups in a page synchronized by using `syncKey`.
75+
76+
All tabs on a page with the same `syncKey` value will display the same active label. This is especially helpful when documenting programming languages. Note that the synching only persists on the page, not across pages.
77+
78+
Add an identical `syncKey` property to each `<TabItem>`.
79+
80+
```js {1, 8}
81+
<Tabs syncKey="constellations">
82+
<TabItem label="Orion">Bellatrix</TabItem>
83+
<TabItem label="Gemini">Pollux</TabItem>
84+
</Tabs>
85+
86+
_Some exoplanets:_
87+
88+
<Tabs syncKey="constellations">
89+
<TabItem label="Orion">HD 34445 b</TabItem>
90+
<TabItem label="Gemini">Pollux b</TabItem>
91+
</Tabs>
92+
```
93+
94+
#### Example
95+
96+
<Tabs syncKey="constellations">
97+
<TabItem label="Orion">Bellatrix</TabItem>
98+
<TabItem label="Gemini">Pollux</TabItem>
99+
</Tabs>
100+
101+
<hr />
102+
103+
<Tabs syncKey="constellations">
104+
<TabItem label="Orion">HD 34445 b</TabItem>
105+
<TabItem label="Gemini">Pollux b</TabItem>
106+
</Tabs>
107+
108+
:::note
109+
You can also [add icons](https://starlight.astro.build/components/tabs/#add-icons-to-tabs) to the tabs, but as of June 2025, you're limited to Starlight's [built-in icons](https://starlight.astro.build/reference/icons/#all-icons).
110+
:::
79111
80112
## Misc
81113
82114
### Style a single page with CSS
83115
84116
If there's a style you need to apply to an entire page, to every instance of an element, you can do so in the frontmatter.
85117
86-
For example, the tables in the [Sequence diagram style guide](/content/sequence-diagrams) were behaving poorly. Text aligned itself to `baseline` which pushed the content in the last row outside of the table's bounds. Also, some code that needed to appear on a single line was breaking.
118+
For example, the tables in the [Sequence diagram style guide](/content/sequence-diagrams) were behaving poorly. Text aligned itself to `baseline` which pushed the content in the last row outside the table's bounds. Also, some code that needed to appear on a single line was breaking.
87119
88-
Instead of adding styles within each table in the page, the styles were applied to the page itself like so:
120+
Instead of adding styles in each table in the page, the styles were applied to the page itself like so:
89121
90122
```
91123
---

vale/config/vocabularies/ilf/accept.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ Postgres
2424
repo
2525
[Rr]evshare
2626
[Rr]afiki
27+
[Tt]estnet

0 commit comments

Comments
 (0)