본문으로 건너뛰기
Pixi’VN

Markdown

Pixi’VN에서 Markdown 사용 및 통합에 대한 개요. React, Vue, Svelte, Angular 예제 포함.

Pixi’VN은 어떤 마크업에도 종속되지 않으며, 개발자가 원하는 마크업을 선택할 수 있는 자유를 제공합니다. 그러나 Markdown을 사용하는 것을 권장합니다.

템플릿

모든 템플릿에서 Markdown 컴포넌트는 이미 정의되어 있습니다.

ink

이 메서드는 ink 문법과 함께 사용할 수 있습니다. 자세한 내용은 여기를 참조하세요.

다음은 JavaScript 생태계에서 Markdown을 구현하는 몇 가지 예제입니다:

// I use the @tanstack/markdown library to convert the Markdown to HTML
// read more about it here: https://www.npmjs.com/package/@tanstack/markdown
// Tables, strikethrough and task lists (GFM) are supported out of the box,
// `allowHtml` enables raw HTML (e.g. <span style="color:blue">...</span>).
import { Markdown } from "@tanstack/markdown/react";

export default function MarkdownComponent({ text }: { text: string }) {
    return <Markdown allowHtml>{text}</Markdown>;
}

Markdown Typewriter

Markdown Typewriter is a library that combines Markdown and Typewriter. 이 라이브러리는 React 템플릿의 Markdown 컴포넌트에 타이프라이터 효과를 추가해야 하는 저의 필요에 의해 제가 직접 만들었습니다.

It renders Markdown with @tanstack/markdown and accepts its props. With allowHtml, raw HTML is typed out too, keeping its attributes: <span style="color:blue">...</span> is blue while it appears.

npm install markdown-typewriter motion @tanstack/markdown
React
import { MarkdownTypewriter } from "markdown-typewriter/react";

export default function MarkdownComponent({ text }: { text: string }) {
    return <MarkdownTypewriter allowHtml>{text}</MarkdownTypewriter>;
}

이 페이지에서