Docs and Markdown integrations
Write a code block with the language fluxygram in your Markdown and it becomes an animated diagram. No HTML, no imports in the page. This page uses it:
The code block
Section titled “The code block”Put the diagram JSON inside, or point to a file with src:
```fluxygram{ "type": "flow", "nodes": [...], "edges": [...], "steps": [...] }```
```fluxygram src="/diagrams/checkout.flux.json"```After the language you can add the same attributes as the component: theme=light, autoplay=false, controls=false, lang=es, and for live status mode=tracker stage=shipped.
```fluxygram theme=light autoplay=falseSet it up
Section titled “Set it up”npm install @fluxygram/astroimport { defineConfig } from 'astro/config';import fluxygram from '@fluxygram/astro';
export default defineConfig({ integrations: [fluxygram()], // with Starlight: [fluxygram(), starlight({ ... })]});It works in .md and .mdx, and loads the component on every page, so you can also write <fluxy-gram> by hand.
npm install @fluxygram/docusaurus @fluxygram/markdownimport { remarkFluxygram } from '@fluxygram/markdown';
export default { plugins: ['@fluxygram/docusaurus'], presets: [ [ 'classic', { docs: { remarkPlugins: [remarkFluxygram] }, blog: { remarkPlugins: [remarkFluxygram] }, }, ], ],};The plugin loads the component in the browser; the remark plugin turns the code blocks into diagrams.
npm install @fluxygram/markdown @fluxygram/elementimport { defineConfig } from 'vitepress';import { markdownItFluxygram } from '@fluxygram/markdown';
export default defineConfig({ markdown: { config: (md) => md.use(markdownItFluxygram) }, vue: { template: { compilerOptions: { isCustomElement: (tag) => tag === 'fluxy-gram' } } },});import DefaultTheme from 'vitepress/theme';
export default { extends: DefaultTheme, enhanceApp() { if (!import.meta.env.SSR) import('@fluxygram/element'); },};Any tool built on remark (Next.js with @next/mdx, Nextra, Gatsby, plain unified) takes the remark plugin:
npm install @fluxygram/markdown @fluxygram/elementimport createMDX from '@next/mdx';import { remarkFluxygram } from '@fluxygram/markdown';
const withMDX = createMDX({ options: { remarkPlugins: [remarkFluxygram] } });export default withMDX({ pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'] });Then load the component once on the client, for example in a layout: useEffect(() => { import('@fluxygram/element'); }, []).
The Fluxygram plugin for Obsidian is on its way to the community plugins. It turns the same fluxygram code blocks into diagrams in your notes and follows Obsidian’s light or dark theme.
Anything else
Section titled “Anything else”Any other Markdown tool built on markdown-it takes markdownItFluxygram. For a plain HTML page, add the CDN script and write the tag.