A lightweight, fast and extensible Svelte Markdown editor and viewer.
Find a file
2024-01-16 19:27:27 +01:00
.github/workflows ci: update pnpm version in workflows 2023-12-19 21:51:56 +01:00
.husky emoji extension 2023-05-06 16:50:52 +02:00
.vscode docs: add search 2023-11-19 15:04:06 +01:00
docs docs(add docs for anchor plugin): add docs for anchor plugin 2024-01-16 23:22:26 +07:00
images update demo and readme 2023-07-19 19:15:39 +02:00
packages feat(add new plugin: anchor): add new plugin: anchor 2024-01-16 23:17:32 +07:00
scripts chore: add plugin-achor to list of packages 2024-01-16 19:24:48 +01:00
.eslintignore docs: add introduction and examples 2023-11-15 22:32:07 +01:00
.eslintrc.json build: replace eslint-plugin-svelte3 with eslint-plugin-svelte 2023-11-07 12:05:05 +01:00
.gitignore setup slash plugin enviroment 2023-05-04 22:24:05 +02:00
.npmrc add code blocks syntax highlighting 2023-05-07 22:05:12 +02:00
.prettierignore improved syntax highlighting 2023-07-14 08:49:16 +02:00
.prettierrc docs: add introduction and examples 2023-11-15 22:32:07 +01:00
LICENSE Create LICENSE 2023-05-10 12:00:25 +02:00
package.json feat: add custom labels support (#23) 2023-12-16 23:23:38 +01:00
pnpm-lock.yaml feat(add new plugin: anchor): add new plugin: anchor 2024-01-16 23:17:32 +07:00
pnpm-workspace.yaml docs: replace demo with docs 2023-11-19 15:44:30 +01:00
README.md docs(add docs for anchor plugin): add docs for anchor plugin 2024-01-16 23:22:26 +07:00
tsconfig.json fix: tsconfig TS6310 may not disable emit 2023-11-14 18:31:24 +01:00


Carta
Swiftly edit and render Markdown, with no overhead.


Introduction

Carta is a lightweight, fast and extensible Svelte Markdown editor and viewer, based on Marked. Check out the examples to see it in action. Differently from most editors, Carta includes neither ProseMirror nor CodeMirror, allowing for an extremely small bundle size and fast loading time.

Features

  • Keyboard shortcuts (extensible);
  • Toolbar (extensible);
  • Markdown syntax highlighting;
  • 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;
  • Code blocks syntax highlighting (plugin).

Packages

Package Status Docs
carta-md carta-md /
plugin-math plugin-math /plugins/math
plugin-code plugin-code /plugins/code
plugin-emoji plugin-emoji /plugins/emoji
plugin-slash plugin-slash /plugins/slash
plugin-tikz plugin-tikz /plugins/tikz
plugin-attachment plugin-attachment /plugins/attachment
plugin-anchor plugin-anchor /plugins/anchor

Getting started

Warning

Sanitization is not dealt with by Carta. You need to provide a sanitizer in the options. Common sanitizers are isomorphic-dompurify (suggested) and sanitize-html.

Installation

Core package:

npm i carta-md

Plugins:

npm i @cartamd/plugin-name

Basic configuration

<script lang="ts">
	import { Carta, CartaEditor } from 'carta-md';
	// Component default theme
	import 'carta-md/default.css';
	// Markdown input theme (Speed Highlight)
	import 'carta-md/light.css';

	const carta = new Carta({
		// Remember to use a sanitizer to prevent XSS attacks
		// sanitizer: mySanitizer
	});
</script>

<CartaEditor {carta} />

<style>
	/* Or in global stylesheet */
	/* Set your custom monospace font */
	:global(.carta-font-code) {
		font-family: '...', monospace;
	}
</style>

Documentation

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

Contributing & Development

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

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

Committing

This repository is commitizen friendly. To commit use:

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