@markgrafhq/docusaurus-plugin-markgraf 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mark Eibes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # @markgrafhq/docusaurus-plugin-markgraf
2
+
3
+ Docusaurus plugin + component for embedding [markgraf](https://github.com/markgrafhq) animations.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @markgrafhq/docusaurus-plugin-markgraf @markgrafhq/markgraf-react
9
+ ```
10
+
11
+ ## Configure
12
+
13
+ ```js
14
+ // docusaurus.config.js
15
+ import remarkMarkgraf from "@markgrafhq/docusaurus-plugin-markgraf/remark";
16
+
17
+ export default {
18
+ presets: [
19
+ [
20
+ "classic",
21
+ {
22
+ docs: { remarkPlugins: [remarkMarkgraf] },
23
+ blog: { remarkPlugins: [remarkMarkgraf] },
24
+ },
25
+ ],
26
+ ],
27
+ plugins: ["@markgrafhq/docusaurus-plugin-markgraf"],
28
+ };
29
+ ```
30
+
31
+ Then add the CSS in your custom CSS entry:
32
+
33
+ ```css
34
+ @import "@markgrafhq/markgraf-react/dist/markgraf-react.css";
35
+ ```
36
+
37
+ ## Use
38
+
39
+ Fenced code blocks with the `markgraf` language render as live players:
40
+
41
+ ````markdown
42
+ ```markgraf
43
+ seed 1
44
+ keyframe v1 {
45
+ +node client "Client"
46
+ +node api "API"
47
+ +edge client api
48
+ client -> api "GET /user/42"
49
+ }
50
+ ```
51
+ ````
52
+
53
+ Or use the component directly in MDX:
54
+
55
+ ```mdx
56
+ import { Markgraf } from "@markgrafhq/docusaurus-plugin-markgraf";
57
+
58
+ <Markgraf src={`seed 1\nkeyframe v1 { +node a "A" }`} />
59
+ ```
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export interface MarkgrafProps {
3
+ src: string;
4
+ renderer?: "canvas" | "svg";
5
+ className?: string;
6
+ }
7
+ export default function Markgraf({ src, renderer, className }: MarkgrafProps): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MarkgrafPlayer } from "@markgrafhq/markgraf-react";
3
+ export default function Markgraf({ src, renderer = "canvas", className }) {
4
+ if (typeof window === "undefined") {
5
+ return _jsx("div", { className: className, "data-markgraf-placeholder": true });
6
+ }
7
+ return (_jsx("div", { className: className, children: _jsx(MarkgrafPlayer, { src: src, renderer: renderer }) }));
8
+ }
@@ -0,0 +1,13 @@
1
+ import remarkMarkgraf from "./remark-markgraf.mjs";
2
+ export { default as Markgraf } from "./Markgraf.js";
3
+ export default function pluginMarkgraf(): {
4
+ name: string;
5
+ configureWebpack(): {
6
+ resolve: {
7
+ extensionAlias: {
8
+ ".js": string[];
9
+ };
10
+ };
11
+ };
12
+ };
13
+ export { remarkMarkgraf };
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import remarkMarkgraf from "./remark-markgraf.mjs";
2
+ export { default as Markgraf } from "./Markgraf.js";
3
+ export default function pluginMarkgraf() {
4
+ return {
5
+ name: "markgraf-docusaurus",
6
+ configureWebpack() {
7
+ return { resolve: { extensionAlias: { ".js": [".js", ".ts", ".tsx"] } } };
8
+ },
9
+ };
10
+ }
11
+ export { remarkMarkgraf };
@@ -0,0 +1,56 @@
1
+ import { visit } from "unist-util-visit";
2
+
3
+ const importNode = {
4
+ type: "mdxjsEsm",
5
+ value: 'import Markgraf from "@markgrafhq/docusaurus-plugin-markgraf/dist/Markgraf.js";',
6
+ data: {
7
+ estree: {
8
+ type: "Program",
9
+ sourceType: "module",
10
+ body: [
11
+ {
12
+ type: "ImportDeclaration",
13
+ specifiers: [
14
+ {
15
+ type: "ImportDefaultSpecifier",
16
+ local: { type: "Identifier", name: "Markgraf" },
17
+ },
18
+ ],
19
+ source: {
20
+ type: "Literal",
21
+ value: "@markgrafhq/docusaurus-plugin-markgraf/dist/Markgraf.js",
22
+ raw: '"@markgrafhq/docusaurus-plugin-markgraf/dist/Markgraf.js"',
23
+ },
24
+ },
25
+ ],
26
+ },
27
+ },
28
+ };
29
+
30
+ export default function remarkMarkgraf() {
31
+ return (tree) => {
32
+ let needsImport = false;
33
+
34
+ visit(tree, "code", (node, index, parent) => {
35
+ if (node.lang !== "markgraf" || !parent || index == null) return;
36
+
37
+ needsImport = true;
38
+
39
+ const src = node.value;
40
+ parent.children[index] = {
41
+ type: "mdxJsxFlowElement",
42
+ name: "Markgraf",
43
+ attributes: [
44
+ {
45
+ type: "mdxJsxAttribute",
46
+ name: "src",
47
+ value: src,
48
+ },
49
+ ],
50
+ children: [],
51
+ };
52
+ });
53
+
54
+ if (needsImport) tree.children.unshift(importNode);
55
+ };
56
+ }
@@ -0,0 +1,56 @@
1
+ import { visit } from "unist-util-visit";
2
+
3
+ const importNode = {
4
+ type: "mdxjsEsm",
5
+ value: 'import Markgraf from "@markgrafhq/docusaurus-plugin-markgraf/dist/Markgraf.js";',
6
+ data: {
7
+ estree: {
8
+ type: "Program",
9
+ sourceType: "module",
10
+ body: [
11
+ {
12
+ type: "ImportDeclaration",
13
+ specifiers: [
14
+ {
15
+ type: "ImportDefaultSpecifier",
16
+ local: { type: "Identifier", name: "Markgraf" },
17
+ },
18
+ ],
19
+ source: {
20
+ type: "Literal",
21
+ value: "@markgrafhq/docusaurus-plugin-markgraf/dist/Markgraf.js",
22
+ raw: '"@markgrafhq/docusaurus-plugin-markgraf/dist/Markgraf.js"',
23
+ },
24
+ },
25
+ ],
26
+ },
27
+ },
28
+ };
29
+
30
+ export default function remarkMarkgraf() {
31
+ return (tree) => {
32
+ let needsImport = false;
33
+
34
+ visit(tree, "code", (node, index, parent) => {
35
+ if (node.lang !== "markgraf" || !parent || index == null) return;
36
+
37
+ needsImport = true;
38
+
39
+ const src = node.value;
40
+ parent.children[index] = {
41
+ type: "mdxJsxFlowElement",
42
+ name: "Markgraf",
43
+ attributes: [
44
+ {
45
+ type: "mdxJsxAttribute",
46
+ name: "src",
47
+ value: src,
48
+ },
49
+ ],
50
+ children: [],
51
+ };
52
+ });
53
+
54
+ if (needsImport) tree.children.unshift(importNode);
55
+ };
56
+ }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@markgrafhq/docusaurus-plugin-markgraf",
3
+ "version": "0.0.26",
4
+ "description": "Docusaurus plugin + component for embedding markgraf animations. Transforms ```markgraf fenced code blocks into a live player and exposes a <Markgraf src=\"…\" /> MDX component.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./remark": {
15
+ "default": "./dist/remark-markgraf.js"
16
+ },
17
+ "./dist/*": "./dist/*",
18
+ "./css": "./node_modules/@markgrafhq/markgraf-react/dist/markgraf-react.css"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "sideEffects": false,
26
+ "scripts": {
27
+ "build": "tsc -p tsconfig.json && cp src/remark-markgraf.mjs dist/remark-markgraf.mjs && cp src/remark-markgraf.mjs dist/remark-markgraf.js"
28
+ },
29
+ "peerDependencies": {
30
+ "@docusaurus/core": ">=3",
31
+ "react": ">=18",
32
+ "react-dom": ">=18"
33
+ },
34
+ "dependencies": {
35
+ "@markgrafhq/markgraf-react": "^0.0.26",
36
+ "unist-util-visit": "^5"
37
+ },
38
+ "devDependencies": {
39
+ "@types/react": "^18",
40
+ "typescript": "^5"
41
+ },
42
+ "keywords": [
43
+ "markgraf",
44
+ "docusaurus",
45
+ "docusaurus-plugin",
46
+ "mdx",
47
+ "remark",
48
+ "animation",
49
+ "diagram"
50
+ ],
51
+ "license": "MIT",
52
+ "author": "Mark Eibes <mark.eibes@gmail.com>",
53
+ "homepage": "https://github.com/markgrafhq/docusaurus-plugin-markgraf#readme",
54
+ "bugs": "https://github.com/markgrafhq/docusaurus-plugin-markgraf/issues",
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/markgrafhq/docusaurus-plugin-markgraf.git"
58
+ }
59
+ }