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
- This plugin requires the import of a heavy library (~7Mb), which is dynamically imported at runtime;
- Generated images are not ssr compatible, as they are rendered in the browser;
- You need to update your sanitizer to allow the specific tag:
<div type="text/tikz">
.
<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} />
Checkout the docs for examples, options and more.