carta/packages/plugin-tikz
BearToCode 342c8d24d0 feat: use unified+rehype for parsing markdown
`marked` has been replaced with a more modern setup involving Unified JS, Rehype and various
plugins.

BREAKING CHANGE: Replaced `marked` with `unified` and `rehype`
2024-04-12 08:24:46 +02:00
..
public add tikz plugin(wip) 2023-07-16 18:17:20 +02:00
src feat: use unified+rehype for parsing markdown 2024-04-12 08:24:46 +02:00
.gitignore add tikz plugin(wip) 2023-07-16 18:17:20 +02:00
package.json feat: use unified+rehype for parsing markdown 2024-04-12 08:24:46 +02:00
README.md refactor: remove verbose prefixes 2024-04-12 08:24:37 +02:00
tsconfig.json fix: remove typescript project references 2023-11-14 18:37:19 +01:00
tsconfig.node.json add tikz plugin(wip) 2023-07-16 18:17:20 +02:00
vite.config.ts don't externalize md5 but move it to dev deps 2023-07-23 19:03:09 +02:00

Carta TikZ Plugin

This plugin adds support for PGF/TikZ illustrations thanks to TikzJax. It uses the code generated for the Obsidian-TikZ plugin. Install it using:

npm i @cartamd/plugin-tikz

Important Notes

  1. This plugin requires the import of a heavy library (~7Mb), which is dynamically imported at runtime;
  2. Generated images are not ssr compatible, as they are rendered in the browser;
  3. You need to update your sanitizer to allow the specific tag: <div type="text/tikz">.

Setup

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

	import '@cartamd/plugin-tikz/fonts.css';

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

<MarkdownEditor {carta} />

Documentation

Checkout the docs for examples, options and more.