Skip to content

Commit

Permalink
Merge branch 'main' into hd-docs-languages-refactor
Browse files Browse the repository at this point in the history
* main: (22 commits)
  fix(docs-i18n-tracker): update `translations` import (withastro#1025)
  [ci] format
  i18n(zh-cn): Update css-and-tailwind.mdx (withastro#1018)
  [ci] format
  i18n(zh-cn): Update authoring-content.md (withastro#1016)
  i18n(ko-KR): update `configuration.mdx` (withastro#1015)
  i18n(ko-KR): update `sidebar.mdx` (withastro#1014)
  i18n(ko-KR): update `i18n.mdx` (withastro#1013)
  [ci] format
  i18n(ko-KR): update `frontmatter.md` (withastro#1017)
  [ci] format
  i18n(pt-BR): Update `css-and-tailwind.mdx`, `authoring-content.md` and `overrides.md` (withastro#1009)
  [ci] format
  [ci] release (withastro#996)
  Fix Prettier-compatibility of i18n test fixture
  Refactor translation system to be reusable in non-Astro code (withastro#1003)
  Add social icons to mobile menu footer (withastro#988)
  [ci] format
  Add Galician language support (withastro#1004)
  feat: add support for light / dark hero images (withastro#280)
  ...
  • Loading branch information
HiDeoo committed Nov 2, 2023
2 parents f8dd327 + 0d1e75e commit 0ad5d8c
Show file tree
Hide file tree
Showing 53 changed files with 597 additions and 182 deletions.
5 changes: 5 additions & 0 deletions .changeset/polite-colts-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/starlight': patch
---

Internal: fix import issue in translation string loading mechanism
5 changes: 0 additions & 5 deletions .changeset/thick-bats-pay.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/src/components/sidebar-preview.astro
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function makeEntries(items: SidebarConfig): SidebarEntry[] {
label: item.label,
entries: makeEntries(item.items as SidebarConfig),
collapsed: item.collapsed,
badge: item.badge,
};
});
}
Expand Down
4 changes: 3 additions & 1 deletion docs/src/content/docs/guides/i18n.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ import I18nList from '../../../components/i18n-list.astro';

In addition to hosting translated content files, Starlight allows you to translate the default UI strings (e.g. the "On this page" heading in the table of contents) so that your readers can experience your site entirely in the selected language.

<I18nList /> translated UI strings are provided out of the box, and we welcome [contributions to add more default languages](https://github.com/withastro/starlight/blob/main/CONTRIBUTING.md).
<I18nList /> translated UI strings are provided out of the box, and we welcome
[contributions to add more default
languages](https://github.com/withastro/starlight/blob/main/CONTRIBUTING.md).

You can provide translations for additional languages you support — or override our default labels — via the `i18n` data collection.

Expand Down
26 changes: 25 additions & 1 deletion docs/src/content/docs/guides/sidebar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ The `sidebar` frontmatter configuration is only used for autogenerated links and

## Badges

Links can also include a `badge` property to display a badge next to the link label.
Links, groups, and autogenerated groups can also include a `badge` property to display a badge next to their label.

```js
starlight({
Expand All @@ -251,6 +251,12 @@ starlight({
},
],
},
// An autogenerated group with a "Deprecated" badge.
{
label: 'Reference',
badge: 'Deprecated',
autogenerate: { directory: 'reference' },
},
],
});
```
Expand All @@ -269,6 +275,24 @@ The configuration above generates the following sidebar:
},
],
},
{
label: 'Reference',
badge: { text: 'Deprecated', variant: 'default' },
items: [
{
label: 'Configuration Reference',
link: '/reference/configuration/',
},
{
label: 'Frontmatter Reference',
link: '/reference/frontmatter/',
},
{
label: 'Overrides Reference',
link: '/reference/overrides/',
},
],
},
]}
/>

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/ko/guides/i18n.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Starlight는 귀하가 모든 언어로 같은 페이지를 생성할 것을 기

Starlight를 사용하면 번역된 콘텐츠 파일을 호스팅하는 것 외에도 독자가 선택한 언어로 사이트 전체를 경험할 수 있도록 기본 UI 문자열(예를 들어, 목차의 제목인 "목차")을 번역할 수 있습니다.

영어, 체코어, 프랑스어, 독일어, 이탈리아어, 일본어, 포르투갈어, 네덜란드어, 덴마크어, 스페인어, 터키어, 아랍어, 노르웨이어, 페르시아어, 히브리어, 중국어 간체, 한국어, 인도네시아어, 러시아어, 스웨덴어, 우크라이나어 및 베트남어로 번역된 UI 문자열이 기본적으로 제공됩니다. 그리고 우리는 [더 많은 기본 언어를 추가하는 데 기여](https://github.com/withastro/starlight/blob/main/CONTRIBUTING.md)하는걸 환영합니다.
영어, 체코어, 프랑스어, 독일어, 이탈리아어, 일본어, 포르투갈어, 네덜란드어, 덴마크어, 스페인어, 터키어, 아랍어, 노르웨이어, 페르시아어, 히브리어, 중국어 간체, 한국어, 인도네시아어, 러시아어, 스웨덴어, 우크라이나어, 베트남어 및 갈리시아어로 번역된 UI 문자열이 기본적으로 제공됩니다. 그리고 우리는 [더 많은 기본 언어를 추가하는 데 기여](https://github.com/withastro/starlight/blob/main/CONTRIBUTING.md)하는걸 환영합니다.

`i18n` 데이터 컬렉션을 통해 지원하는 추가 언어에 대한 번역을 제공하거나 기본 라벨을 변경할 수 있습니다.

Expand Down
26 changes: 25 additions & 1 deletion docs/src/content/docs/ko/guides/sidebar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ sidebar:

## 배지

링크 라벨 옆에 배지를 표시하기 위해 링크에는 `badge` 속성이 포함될 수도 있습니다.
링크, 그룹, 자동 생성된 그룹은 라벨 옆에 배지를 표시하기 위해 `badge` 속성을 포함할 수도 있습니다.

```js
starlight({
Expand All @@ -252,6 +252,12 @@ starlight({
},
],
},
// "Deprecated" 배지가 포함된 자동 생성된 그룹
{
label: '참조',
badge: 'Deprecated',
autogenerate: { directory: 'reference' },
},
],
});
```
Expand All @@ -270,6 +276,24 @@ starlight({
},
],
},
{
label: '참조',
badge: { text: 'Deprecated', variant: 'default' },
items: [
{
label: '구성 참조',
link: '/reference/configuration/',
},
{
label: '프론트매터 참조',
link: '/reference/frontmatter/',
},
{
label: '재정의 참조',
link: '/reference/overrides/',
},
],
},
]}
/>

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/ko/reference/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ sidebar: [
type SidebarItem = {
label: string;
translations?: Record<string, string>;
badge?: string | BadgeConfig;
} & (
| {
link: string;
badge?: string | BadgeConfig;
attrs?: Record<string, string | number | boolean | undefined>;
}
| { items: SidebarItem[]; collapsed?: boolean }
Expand Down
40 changes: 32 additions & 8 deletions docs/src/content/docs/ko/reference/frontmatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,44 @@ hero:
---
```

밝은 모드와 어두운 모드에서 다양한 버전의 hero 이미지를 표시할 수 있습니다.

```md
---
hero:
image:
alt: 반짝이는 밝은 색상의 로고
dark: ../../assets/logo-dark.png
light: ../../assets/logo-light.png
---
```

#### `HeroConfig`

```ts
interface HeroConfig {
title?: string;
tagline?: string;
image?: {
alt?: string;
// 저장소에 있는 이미지의 상대 경로입니다.
file?: string;
// 이미지 슬롯에 사용할 Raw HTML입니다.
// 사용자 정의 `<img>` 태그 또는 인라인 `<svg>`일 수 있습니다.
html?: string;
};
image?:
| {
// 저장소에 있는 이미지의 상대 경로입니다.
file: string;
// 보조 기술이 이미지에 접근할 수 있도록 하는 대체 텍스트입니다.
alt?: string;
}
| {
// 어두운 모드에 사용할 저장소의 이미지에 대한 상대 경로입니다.
dark: string;
// 밝은 모드에 사용할 저장소의 이미지에 대한 상대 경로입니다.
light: string;
// 보조 기술이 이미지에 접근할 수 있도록 하는 대체 텍스트입니다.
alt?: string;
}
| {
// 이미지 슬롯에 사용할 원시 HTML입니다.
// 사용자 정의 `<img>` 태그 또는 인라인 `<svg>` 태그일 수 있습니다.
html: string;
};
actions?: Array<{
text: string;
link: string;
Expand Down
4 changes: 4 additions & 0 deletions docs/src/content/docs/pt-br/guides/authoring-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,7 @@ Longos blocos de código de linha única não devem quebrar linha. Eles devem ro
## Outras funcionalidades comuns do Markdown

Starlight suporta todo o resto da sintaxe de escrita do Markdown, como listas e tabelas. Veja a [Cheat Sheet de Markdown do The Markdown Guide](https://www.markdownguide.org/cheat-sheet/) para uma visão geral rápida de todos os elementos da sintaxe do Markdown.

## Markdown Avançado e Configurando MDX

O Starlight utiliza o mesmo rendizador Markdown e MDX do Astro, que suporta remark e rehype. Você pode adicionar sintaxe e comportamento personalizado adicionando `remarkPlugins` ou `rehypePlugins` no seu arquivo de configuração Astro. Visite [Configurando Markdown e MDX](https://docs.astro.build/pt-br/guides/markdown-content/#configurando-markdown-e-mdx) na documentação do Astro para saber mais.
16 changes: 8 additions & 8 deletions docs/src/content/docs/pt-br/guides/css-and-tailwind.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ Se você já tem um site Starlight e quer adicionar Tailwind CSS, siga estes pas
});
```

5. Adicione o plugin Starlight Tailwind em `tailwind.config.cjs`:
5. Adicione o plugin Starlight Tailwind em `tailwind.config.mjs`:

```js ins={2,7}
// tailwind.config.cjs
const starlightPlugin = require('@astrojs/starlight-tailwind');
// tailwind.config.mjs
import starlightPlugin from '@astrojs/starlight-tailwind';

/** @type {import('tailwindcss').Config} */
module.exports = {
export default {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
plugins: [starlightPlugin()],
};
Expand All @@ -206,12 +206,12 @@ Se definidas, as seguintes opções irão sobrescrever os estilos padrões do St
- `fontFamily.mono` — usado para códigos de exemplo

```js {12,14,18,20}
// tailwind.config.cjs
const starlightPlugin = require('@astrojs/starlight-tailwind');
const colors = require('tailwindcss/colors');
// tailwind.config.mjs
import starlightPlugin from '@astrojs/starlight-tailwind';
import colors from 'tailwindcss/colors';

/** @type {import('tailwindcss').Config} */
module.exports = {
export default {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
theme: {
extend: {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/pt-br/reference/overrides.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Sumário da página, se ativado.
**Tipos:** `{ depth: number; slug: string; text: string }[]`

Arranjo de todos os títulos Markdown extraídos da página atual.
Utilize [`toc`](#toc) ao invés se você deseja construir um sumário que respeita as configurações do Starlight.
Utilize [`toc`](#toc) em vez disso se você deseja construir um componente de sumário que respeita as configurações do Starlight.

#### `lastUpdated`

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/reference/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ sidebar: [
type SidebarItem = {
label: string;
translations?: Record<string, string>;
badge?: string | BadgeConfig;
} & (
| {
link: string;
badge?: string | BadgeConfig;
attrs?: Record<string, string | number | boolean | undefined>;
}
| { items: SidebarItem[]; collapsed?: boolean }
Expand Down
40 changes: 32 additions & 8 deletions docs/src/content/docs/reference/frontmatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,44 @@ hero:
---
```

You can display different versions of the hero image in light and dark modes.

```md
---
hero:
image:
alt: A glittering, brightly colored logo
dark: ../../assets/logo-dark.png
light: ../../assets/logo-light.png
---
```

#### `HeroConfig`

```ts
interface HeroConfig {
title?: string;
tagline?: string;
image?: {
alt?: string;
// Relative path to an image in your repository.
file?: string;
// Raw HTML to use in the image slot.
// Could be a custom `<img>` tag or inline `<svg>`.
html?: string;
};
image?:
| {
// Relative path to an image in your repository.
file: string;
// Alt text to make the image accessible to assistive technology
alt?: string;
}
| {
// Relative path to an image in your repository to be used for dark mode.
dark: string;
// Relative path to an image in your repository to be used for light mode.
light: string;
// Alt text to make the image accessible to assistive technology
alt?: string;
}
| {
// Raw HTML to use in the image slot.
// Could be a custom `<img>` tag or inline `<svg>`.
html: string;
};
actions?: Array<{
text: string;
link: string;
Expand Down
4 changes: 4 additions & 0 deletions docs/src/content/docs/zh-cn/guides/authoring-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,7 @@ var fun = function lang(l) {
## 其它通用 Markdown 语法

Starlight 支持所有其他 Markdown 语法,例如列表和表格。 请参阅 [Markdown 指南的 Markdown 速查表](https://www.markdownguide.org/cheat-sheet/) 以快速了解所有 Markdown 语法元素。

## 高级 Markdown 和 MDX 配置

Starlight 使用 Astro 的 Markdown 和 MDX 渲染器,该渲染器构建在 remark 和 rehype 之上。 你可以通过在 Astro 配置文件中添加 `remarkPlugins``rehypePlugins` 来添加对自定义语法和行为的支持。 请参阅 Astro 文档中的 [“配置 Markdown 和 MDX”](https://docs.astro.build/zh-cn/guides/markdown-content/#配置-markdown) 以了解更多信息。
16 changes: 8 additions & 8 deletions docs/src/content/docs/zh-cn/guides/css-and-tailwind.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ yarn create astro --template starlight/tailwind
});
```

5. 将 Starlight Tailwind 插件添加到 `tailwind.config.cjs`
5. 将 Starlight Tailwind 插件添加到 `tailwind.config.mjs`

```js ins={2,7}
// tailwind.config.cjs
const starlightPlugin = require('@astrojs/starlight-tailwind');
// tailwind.config.mjs
import starlightPlugin from '@astrojs/starlight-tailwind';

/** @type {import('tailwindcss').Config} */
module.exports = {
export default {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
plugins: [starlightPlugin()],
};
Expand All @@ -206,12 +206,12 @@ Starlight 将使用你的 [Tailwind 主题配置](https://tailwindcss.com/docs/t
- `fontFamily.mono` — 用于代码示例

```js {12,14,18,20}
// tailwind.config.cjs
const starlightPlugin = require('@astrojs/starlight-tailwind');
const colors = require('tailwindcss/colors');
// tailwind.config.mjs
import starlightPlugin from '@astrojs/starlight-tailwind';
import colors from 'tailwindcss/colors';

/** @type {import('tailwindcss').Config} */
module.exports = {
export default {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
theme: {
extend: {
Expand Down
2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.11.2",
"@astrojs/starlight": "^0.12.0",
"astro": "^3.2.3",
"sharp": "^0.32.5"
}
Expand Down
4 changes: 2 additions & 2 deletions examples/tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.11.2",
"@astrojs/starlight-tailwind": "^2.0.0",
"@astrojs/starlight": "^0.12.0",
"@astrojs/starlight-tailwind": "^2.0.1",
"@astrojs/tailwind": "^5.0.0",
"astro": "^3.2.3",
"sharp": "^0.32.5",
Expand Down
Loading

0 comments on commit 0ad5d8c

Please sign in to comment.