npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

carta-md

v4.6.7

Published

A lightweight, fully customizable, Markdown editor

Downloads

4,715

Readme

Carta.png

Introduction

NOTE: Carta has recently been updated to v4, which features numerous major changes.

Follow the Migration Guide to update your project.

Carta is a lightweight, fast and extensible Svelte Markdown editor and viewer. It is powered by unified, remark and rehype. Check out the examples to see it in action. Differently from most editors, Carta does not include a code editor, but it is just a textarea with syntax highlighting, shortcuts and more.

Features

  • 🌈 Markdown syntax highlighting (Shiki);
  • 🛠️ Toolbar (extensible);
  • ⌨️ Keyboard shortcuts (extensible);
  • 📦 Supports 150+ 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 blocks syntax highlighting (plugin).
  • ⚙️ Embed Components (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 | | plugin-component | plugin-component | /plugins/component |

Community plugins

| Plugin | Description | | ----------------------------------------------------------------------------- | ---------------------------------- | | carta-plugin-video | Render online videos | | carta-plugin-imsize | Render images in specific sizes | | carta-plugin-subscript | Render 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 a sanitizer in the options. Common sanitizers are isomorphic-dompurify (suggested) and sanitize-html. Checkout the documentation for an example.

Installation

Core package:

npm i carta-md

Plugins:

npm i @cartamd/plugin-name

Basic configuration

<script lang="ts">
	import { Carta, MarkdownEditor } from 'carta-md';
	// Component default theme
	import 'carta-md/default.css';

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

<MarkdownEditor {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;
	}
</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 use plugin-code on the server, as the highlighter is no longer present there.

// vite.config.js
import { sveltekit } from '@sveltejs/kit/vite';

/** @type {import('vite').UserConfig} */
const config = {
	plugins: [sveltekit()],
	define: {
		__ENABLE_CARTA_SSR_HIGHLIGHTER__: false
	}
};
export default config;

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

Running docs

If you want to preview the docs:

cd docs
npm run dev