carta/packages/plugin-slash
BearToCode 92ec673efa build: sync plugins major version master
Bump version to `3.0.0`

BREAKING CHANGE: Bump version to `3.0.0`
2023-11-11 16:48:37 +01:00
..
src refactor: use consistent file name for default styles 2023-11-11 11:19:52 +01:00
static convert plugins vite packages to sveltekit 2023-05-26 20:03:53 +02:00
.gitignore convert plugins vite packages to sveltekit 2023-05-26 20:03:53 +02:00
package.json build: sync plugins major version master 2023-11-11 16:48:37 +01:00
README.md refactor: use consistent file name for default styles 2023-11-11 11:19:52 +01:00
svelte.config.js convert plugins vite packages to sveltekit 2023-05-26 20:03:53 +02:00
tsconfig.json convert plugins vite packages to sveltekit 2023-05-26 20:03:53 +02:00
vite.config.ts convert plugins vite packages to sveltekit 2023-05-26 20:03:53 +02:00

Carta Slash Plugin

This plugin adds support for Slash commands. Install it using:

npm i @cartamd/plugin-slash

Setup

Styles

Import the default theme, or create you own:

import '@cartamd/plugin-slash/default.css';

Extension

<script lang="ts">
	import { Carta, CartaEditor } from 'carta-md';
	import { slash } from '@cartamd/plugin-slash';

	const carta = new Carta({
		extensions: [slash()]
	});
</script>

<CartaEditor {carta} />

Options

Here are the options you can pass to slash():

export interface SlashExtensionOptions {
	/**
	 * List of default snippets to disable.
	 */
	disableDefaultSnippets?: DefaultSnippetId[] | true;
	/**
	 * Additional snippets.
	 */
	snippets?: SlashSnippet[];
	/**
	 * Custom in transition. See https://svelte.dev/docs#run-time-svelte-transition.
	 */
	inTransition?: (node: Element) => TransitionConfig;
	/**
	 * Custom out transition. See https://svelte.dev/docs#run-time-svelte-transition.
	 */
	outTransition?: (node: Element) => TransitionConfig;
}