Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A lightweight, fast and extensible Svelte Markdown editor and viewer.

License

NotificationsYou must be signed in to change notification settings

BearToCode/carta

Repository files navigation

npmbundlelicensedocs

Logo

Carta

Modern, lightweight, powerful Markdown Editor.


Introduction

Carta is alightweight,fast andextensible Svelte Markdown editor and viewer. It is powered byunified,remark andrehype. Check out theexamples to see it in action.Differently from most editors, Carta does not include a code editor, but it isjust a textarea with syntax highlighting, shortcuts and more.

Features

  • 🌈 Markdown syntax highlighting (Shiki);
  • 🛠️ Toolbar (extensible);
  • ⌨️ Keyboardshortcuts (extensible);
  • 📦 Supports150+ plugins thanks to remark;
  • 🔀 Scroll sync;
  • ✅ Accessibility friendly;
  • 🖥️SSR compatible;
  • ⚗️KaTeX support (plugin);
  • 🔨Slash commands (plugin);
  • 😄Emojis, with included search (plugin);
  • ✏️TikZ support (plugin);
  • 📂Attachment support (plugin);
  • Anchor links in headings (plugin);
  • 🌈 Code blockssyntax highlighting (plugin);
  • ⚙️ EmbedComponents (plugin).

Packages

PackageStatusDocs
carta-mdcarta-md/
plugin-mathplugin-math/plugins/math
plugin-codeplugin-code/plugins/code
plugin-emojiplugin-emoji/plugins/emoji
plugin-slashplugin-slash/plugins/slash
plugin-tikzplugin-tikz/plugins/tikz
plugin-attachmentplugin-attachment/plugins/attachment
plugin-anchorplugin-anchor/plugins/anchor
plugin-componentplugin-component/plugins/component

Community plugins

PluginDescription
carta-plugin-videoRender online videos
carta-plugin-imsizeRender images in specific sizes
carta-plugin-subscriptRender subscripts and superscripts
carta-plugin-ins-del<ins> and<del> tags support

Getting started

Warning

Sanitization is not dealt with by Carta. You need to provide asanitizer in the options.Common sanitizers areisomorphic-dompurify (suggested) andsanitize-html.Checkout the documentation for an example.

Installation

Core package:

npm i carta-md

Plugins:

npm i @cartamd/plugin-name

Basic configuration

<scriptlang="ts">import {Carta,MarkdownEditor }from'carta-md';// Component default themeimport'carta-md/default.css';const carta=newCarta({// Remember to use a sanitizer to prevent XSS attacks// sanitizer: mySanitizer});let value=$state('');</script><MarkdownEditorbind:value {carta} /><style>/* Or in global stylesheet*//* Set your monospace font*//* Required to have the editor working correctly!*/:global(.carta-font-code) {font-family:'...',monospace;font-size:1.1rem;line-height:1.1rem;letter-spacing:normal;}</style>

Flags

You can reduce the server-side bundle by using the following vite config. This will remove shiki from the bundle. It may cause issues if you try to useplugin-code on the server, as the highlighter is no longer present there.

// vite.config.jsimport{sveltekit}from'@sveltejs/kit/vite';/**@type {import('vite').UserConfig} */constconfig={plugins:[sveltekit()],define:{__ENABLE_CARTA_SSR_HIGHLIGHTER__:false}};exportdefaultconfig;

Documentation

For the full documentation, examples, guides and more checkout thewebsite.

Contributing & Development

Every contribution is well accepted. If you have a feature request you can open a new issue.

This package uses apnpm workspace, so pnpm is required to download and put everything together properly.

Committing

This repository iscommitizen friendly. To commit use:

npm run commit# or, if you have commitizen installed globallygit cz

Running docs

If you want to preview the docs:

cd docsnpm run dev

[8]ページ先頭

©2009-2025 Movatter.jp