Skip to content

Commit e4858f6

Browse files
i18n(ko-KR): update mdx.mdx, content-collections.mdx, directives-reference.mdx (#12610)
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
1 parent 93f1d73 commit e4858f6

File tree

4 files changed

+51
-31
lines changed

4 files changed

+51
-31
lines changed

src/content/docs/ko/guides/content-collections.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ const { Content, headings } = await render(entry);
418418
<Content />
419419
```
420420

421+
<ReadMore>MDX 항목을 다룰 때, [사용자 정의 컴포넌트를 `<Content />`에 전달](/ko/guides/integrations-guide/mdx/#components를-mdx-콘텐츠로-전달하기)하여 HTML 요소를 사용자 정의 대안으로 대체할 수도 있습니다.</ReadMore>
422+
421423
#### 콘텐츠를 props로 전달
422424

423425
컴포넌트는 컬렉션 항목 전체를 prop으로 전달할 수도 있습니다.

src/content/docs/ko/guides/integrations-guide/mdx.mdx

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default defineConfig({
8888

8989
표준 MDX 기능 사용에 대해 알아보려면 [MDX 문서](https://mdxjs.com/docs/what-is-mdx/)를 참조하세요.
9090

91-
## Astro의 MDX
91+
## Astro에서 MDX 사용하기
9292

9393
MDX 통합을 추가하면 JSX 변수, 표현식, 컴포넌트로 Markdown을 작성하는 기능이 향상됩니다.
9494

@@ -150,13 +150,12 @@ const posts = Object.values(matches);
150150
- **`<Content />`** - 파일의 렌더링된 전체 콘텐츠를 반환하는 컴포넌트입니다.
151151
- **(모든 `export` 값)** - MDX 파일은 `export` 문을 사용하여 데이터를 내보낼 수도 있습니다.
152152

153-
### MDX에서 프런트매터 변수 사용
153+
### MDX에서 프런트매터 변수 사용하기
154154

155155
기본적으로 Astro MDX 통합은 MDX에서 프런트매터를 사용하는 것을 지원합니다. Markdown 파일과 마찬가지로 프런트매터 속성을 추가하면 이러한 변수를 템플릿에서 사용할 수 있으며, 다른 곳에서 파일을 가져올 때 명명된 속성으로도 사용할 수 있습니다.
156156

157157
```mdx title="/src/blog/posts/post-1.mdx"
158158
---
159-
layout: '../../layouts/BlogPostLayout.astro'
160159
title: 'My first MDX post'
161160
author: 'Houston'
162161
---
@@ -166,7 +165,7 @@ author: 'Houston'
166165
Written by: {frontmatter.author}
167166
```
168167

169-
### MDX에서 컴포넌트 사용
168+
### MDX에서 컴포넌트 사용하기
170169

171170
MDX 통합을 설치한 후에는 다른 Astro 컴포넌트에서 사용하는 것과 마찬가지로 MDX (`.mdx`) 파일에서 [Astro 컴포넌트](/ko/basics/astro-components/)[UI 프레임워크 컴포넌트](/ko/guides/framework-components/#프레임워크-컴포넌트-사용) 모두를 가져와서 사용할 수 있습니다.
172171

@@ -183,51 +182,70 @@ import ReactCounter from '../components/ReactCounter.jsx';
183182
I just started my new Astro blog!
184183

185184
Here is my counter component, working in MDX:
186-
187185
<ReactCounter client:load />
188186
```
189187

190-
#### 가져온 MDX를 사용하는 사용자 정의 컴포넌트
188+
#### HTML 요소에 사용자 정의 컴포넌트 할당하기
189+
190+
MDX를 사용하면 표준 HTML 요소 대신 Markdown 구문을 사용자 정의 컴포넌트에 매핑할 수 있습니다. 이렇게 하면 표준 Markdown 구문으로 작성하되 선택한 요소에 특별한 컴포넌트 스타일을 적용할 수 있습니다.
191191

192-
가져온 MDX 콘텐츠를 렌더링할 때 [사용자 정의 컴포넌트](#html-요소에-사용자-정의-컴포넌트-할당)`components` 속성을 통해 전달될 수 있습니다.
192+
예를 들어, `<blockquote>` 콘텐츠에 사용자 정의 스타일을 제공하는 `Blockquote.astro` 컴포넌트를 만들 수 있습니다.
193193

194-
```astro title="src/pages/page.astro" "components={{...components, h1: Heading }}"
194+
```astro title="src/components/Blockquote.astro"
195195
---
196-
import { Content, components } from '../content.mdx';
197-
import Heading from '../Heading.astro';
196+
const props = Astro.props;
198197
---
199-
<!-- # 구문에 대한 사용자 정의 <h1>을 생성합니다. _그리고_ `content.mdx`에 정의된 모든 사용자 정의 컴포넌트에 적용합니다. -->
200-
<Content components={{...components, h1: Heading }} />
198+
<blockquote {...props} class="bg-blue-50 p-4">
199+
<span class="text-4xl text-blue-600 mb-2">“</span>
200+
<slot /> <!-- 하위 콘텐츠를 위해 `<slot/>`을 추가해야 합니다! -->
201+
</blockquote>
202+
```
203+
204+
사용자 정의 컴포넌트를 `.mdx` 파일로 가져온 다음 표준 HTML 요소를 사용자 정의 컴포넌트에 매핑하는 `components` 객체를 내보냅니다.
205+
206+
```mdx title="src/blog/posts/post-1.mdx"
207+
import Blockquote from '../components/Blockquote.astro';
208+
export const components = {blockquote: Blockquote}
209+
210+
> This quote will be a custom Blockquote
201211
```
202212

213+
사용자 정의 컴포넌트로 덮어쓸 수 있는 HTML 요소의 전체 목록은 [MDX 웹사이트](https://mdxjs.com/table-of-components/)를 참조하세요.
214+
203215
:::note
204216
MDX 파일에서 정의되어 내보내진 사용자 정의 컴포넌트는 가져온 다음 `components` 속성을 통해 `<Content />` 컴포넌트로 다시 전달되어야 합니다.
205217
:::
206218

207-
#### HTML 요소에 사용자 정의 컴포넌트 할당
219+
#### `components`를 MDX 콘텐츠로 전달하기
208220

209-
MDX를 사용하면 표준 HTML 요소 대신 Markdown 구문을 사용자 정의 컴포넌트에 매핑할 수 있습니다. 이렇게 하면 표준 Markdown 구문으로 작성하되 선택한 요소에 특별한 컴포넌트 스타일을 적용할 수 있습니다.
221+
가져온 MDX 콘텐츠를 `<Content />` 컴포넌트를 사용하여 렌더링할 때 (콘텐츠 컬렉션을 사용한 MDX 항목 렌더링 포함), `components` prop을 통해 사용자 정의 컴포넌트를 전달할 수 있습니다. 이러한 컴포넌트는 `<Content />` 컴포넌트에서 사용할 수 있도록 먼저 가져와야 합니다.
210222

211-
사용자 정의 컴포넌트를 `.mdx` 파일로 가져온 다음 표준 HTML 요소를 사용자 정의 컴포넌트에 매핑하는 `components` 객체를 내보냅니다:
223+
`components` 객체는 HTML 요소 이름(`h1`, `h2`, `blockquote` 등)을 사용자 정의 컴포넌트에 매핑합니다. 또한 스프레드 연산자(`...`)를 사용하여 [MDX 파일 자체에서 내보낸 모든 컴포넌트](#html-요소에-사용자-정의-컴포넌트-할당하기)를 포함할 수 있으며, 이 또한 MDX 파일에서 `components`로 가져와야 합니다.
212224

213-
```mdx title="src/blog/posts/post-1.mdx"
214-
import Blockquote from '../components/Blockquote.astro';
215-
export const components = {blockquote: Blockquote}
225+
Astro 컴포넌트에서 사용하기 위해 단일 파일에서 MDX를 직접 가져오는 경우, `Content` 컴포넌트와 MDX 파일에서 내보낸 모든 컴포넌트를 모두 가져와야 합니다.
216226

217-
> This quote will be a custom Blockquote
227+
```astro title="src/pages/page.astro" "components={{...components, h1: Heading }}" {2}
228+
---
229+
import { Content, components } from '../content.mdx';
230+
import Heading from '../Heading.astro';
231+
---
232+
<!-- '#' 구문에서 사용할 사용자 정의 <h1>을 생성하고, `content.mdx`에 정의된 사용자 정의 컴포넌트를 적용합니다. -->
233+
<Content components={{...components, h1: Heading }} />
218234
```
219235

236+
MDX 파일이 콘텐츠 컬렉션 항목인 경우, `astro:content``render()` 함수를 사용하여 `<Content />` 컴포넌트에 접근하세요.
220237

221-
```astro title="src/components/Blockquote.astro"
238+
다음은 `<h1>` HTML 요소 대신 사용될 사용자 정의 제목을 `components` prop을 통해 `<Content />` 컴포넌트에 전달하는 예시입니다.
239+
240+
```astro title="src/pages/blog/post-1.astro" ins="components={{ h1: CustomHeading }}"
222241
---
223-
const props = Astro.props;
242+
import { getEntry, render } from 'astro:content';
243+
import CustomHeading from '../../components/CustomHeading.astro';
244+
const entry = await getEntry('blog', 'post-1');
245+
const { Content } = await render(entry);
224246
---
225-
<blockquote {...props} class="bg-blue-50 p-4">
226-
<span class="text-4xl text-blue-600 mb-2">“</span>
227-
<slot /> <!-- 하위 콘텐츠를 위해 `<slot/>`을 추가해야 합니다! -->
228-
</blockquote>
247+
<Content components={{ h1: CustomHeading }} />
229248
```
230-
사용자 정의 컴포넌트로 덮어쓸 수 있는 HTML 요소의 전체 목록은 [MDX 웹사이트](https://mdxjs.com/table-of-components/)를 참조하세요.
231249

232250
## 구성
233251

@@ -380,7 +398,7 @@ export default defineConfig({
380398

381399
이전에는 `customComponentNames`로 알려졌습니다.
382400

383-
MDX 최적화 프로그램이 [컴포넌트 prop을 통해 가져온 MDX 콘텐츠에 전달된 사용자 정의 컴포넌트](/ko/guides/integrations-guide/mdx/#가져온-mdx를-사용하는-사용자-정의-컴포넌트)와 같은 특정 요소 이름을 처리하지 못하도록 방지하는 `optimize`의 선택적 속성입니다.
401+
MDX 최적화 프로그램이 [컴포넌트 prop을 통해 가져온 MDX 콘텐츠에 전달된 사용자 정의 컴포넌트](#components를-mdx-콘텐츠로-전달하기)와 같은 특정 요소 이름을 처리하지 못하도록 방지하는 `optimize`의 선택적 속성입니다.
384402

385403
최적화 프로그램이 콘텐츠를 정적 문자열로 변환하므로 동적으로 렌더링해야 하는 사용자 정의 컴포넌트가 중단되기 때문에 최적화에서 이러한 컴포넌트를 제외해야 합니다.
386404

@@ -414,9 +432,9 @@ export default defineConfig({
414432
});
415433
```
416434

417-
MDX 파일이 [`export const components = { ... }`를 사용하여 사용자 정의 컴포넌트를 구성](/ko/guides/integrations-guide/mdx/#html-요소에-사용자-정의-컴포넌트-할당)하는 경우, 이 옵션을 수동으로 구성할 필요가 없습니다. 최적화 프로그램은 이를 자동으로 감지합니다.
435+
MDX 파일이 [`export const components = { ... }`를 사용하여 사용자 정의 컴포넌트를 구성](/ko/guides/integrations-guide/mdx/#html-요소에-사용자-정의-컴포넌트-할당하기)하는 경우, 이 옵션을 수동으로 구성할 필요가 없습니다. 최적화 프로그램은 이를 자동으로 감지합니다.
418436

419-
##
437+
## 예시
420438

421439
[Astro MDX 시작 템플릿](https://github.com/withastro/astro/tree/latest/examples/with-mdx)은 Astro 프로젝트에서 MDX 파일을 사용하는 방법을 보여줍니다.
422440

src/content/docs/ko/guides/troubleshooting.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Astro 컴포넌트는 서버에서 실행되므로 프런트매터에서 이러
115115

116116
### 내 컴포넌트가 렌더링되지 않습니다.
117117

118-
먼저, [`.astro` 컴포넌트 스크립트](/ko/basics/astro-components/#컴포넌트-스크립트) 또는 [`.mdx` 파일](/ko/guides/integrations-guide/mdx/#mdx에서-컴포넌트-사용)에서 **컴포넌트를 가져왔**는지 확인하세요.
118+
먼저, [`.astro` 컴포넌트 스크립트](/ko/basics/astro-components/#컴포넌트-스크립트) 또는 [`.mdx` 파일](/ko/guides/integrations-guide/mdx/#mdx에서-컴포넌트-사용하기)에서 **컴포넌트를 가져왔**는지 확인하세요.
119119

120120
그런 다음 가져오기 (import) 문을 확인하세요.
121121

src/content/docs/ko/reference/directives-reference.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ import api from '../db/api.js';
114114

115115
기본적으로 UI 프레임워크 컴포넌트는 클라이언트에서 수화되지 않습니다. `client:*` 지시어가 제공되지 않으면 HTML이 JavaScript 없이 페이지에 렌더링됩니다.
116116

117-
클라이언트 지시어는 `.astro` 컴포넌트로 직접 가져온 UI 프레임워크 컴포넌트에서만 사용할 수 있습니다. [동적 태그](/ko/reference/astro-syntax/#동적-태그)[`components` prop을 통해 전달된 사용자 정의 컴포넌트](/ko/guides/integrations-guide/mdx/#가져온-mdx를-사용하는-사용자-정의-컴포넌트)를 사용할 때는 수화 지시어가 지원되지 않습니다.
117+
클라이언트 지시어는 `.astro` 컴포넌트로 직접 가져온 UI 프레임워크 컴포넌트에서만 사용할 수 있습니다. [동적 태그](/ko/reference/astro-syntax/#동적-태그)[`components` prop을 통해 전달된 사용자 정의 컴포넌트](/ko/guides/integrations-guide/mdx/#components를-mdx-콘텐츠로-전달하기)를 사용할 때는 수화 지시어가 지원되지 않습니다.
118118

119119
### `client:load`
120120

0 commit comments

Comments
 (0)