Vai al contenuto
Pixi’VN

Markdown

Panoramica sull'uso di Markdown e delle sue integrazioni in Pixi’VN, con esempi per React, Vue, Svelte e Angular.

Pixi’VN non è legato ad alcun markup e offre allo sviluppatore la libertà di scegliere il markup che preferisce. Tuttavia, si consiglia di utilizzare Markdown.

Modelli

In tutti i template, il componente Markdown è già definito.

ink

Puoi usare questo metodo con la sintassi ink. Scopri di più qui.

Ecco alcuni esempi di implementazioni di Markdown nell'ecosistema JavaScript:

// 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. Questa libreria è stata creata da me per soddisfare la mia esigenza di aggiungere un effetto macchina da scrivere al componente Markdown nei miei template React.

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>;
}

In questa pagina