Markdown
Pixi’VN에서 Markdown 사용 및 통합에 대한 개요. React, Vue, Svelte, Angular 예제 포함.
Markdown은 일반 텍스트 편집기를 사용하여 서식 있는 텍스트를 만들기 위한 경량 마크업 언어입니다. John Gruber는 2004년에 Aaron Swartz와 협력하여 소스 코드 형태로도 읽기 쉬운 마크업 언어로 Markdown을 만들었습니다. Markdown은 블로그와 인스턴트 메시징에 널리 사용되며, 온라인 포럼, 협업 소프트웨어, 문서 페이지 및 readme 파일에서도 활용됩니다.
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/markdownimport { MarkdownTypewriter } from "markdown-typewriter/react";
export default function MarkdownComponent({ text }: { text: string }) {
return <MarkdownTypewriter allowHtml>{text}</MarkdownTypewriter>;
}