carbon / code2chart
Convert code to chart
Package info
github.com/CarbonPackages/Carbon.Code2Chart
Language:JavaScript
Type:neos-carbon
pkg:composer/carbon/code2chart
Requires
- carbon/notification: ^2.4
- neos/neos: ^5.3 || ^7.0 || ^8.0
- sitegeist/slipstream: ^1.0 || ^2.0
This package is auto-updated.
Last update: 2026-06-15 09:11:22 UTC
README
Convert JavaScript code snippets into visual flowcharts directly inside Neos.
This package provides a Neos content element that lets editors enter code in the inspector and renders a flowchart on the frontend. Optional syntax highlighting for the source code is included.
Features
- Neos content element for code-to-flowchart rendering
- Uses js2flowchart for SVG flowchart generation
- Optional JavaScript syntax highlighting with highlight.js
- Configurable diagram root label
- Configurable max name length for flowchart nodes
- Optional source-code visibility
- Backend notifications for missing or invalid code
Requirements
- Neos:
^8.4 || ^9.0 - PHP package dependencies:
carbon/notification(^2.4 || ^3.0)carbon/fileloader(^0.1)
- Frontend runtime dependencies:
highlight.js(^11.11.1)js2flowchart(^1.3.5)
- Frontend toolchain:
pnpm11.6.0eslint^10.5.0stylelint^17.13.0postcss^8.5.15cssnano^8.0.2esbuild^0.28.1
Installation
Install the package in your Neos distribution (for example via Composer path repository or VCS workflow):
composer require carbon/code2chart
Then install frontend dependencies in this package and build assets:
pnpm install pnpm build
Usage In Neos
After installation, add the content element in the Neos backend:
- Node type:
Carbon.Code2Chart:Content.Item
Inspector properties:
label: Custom root label for the flowchart (fallback isProgram)maxNameLength: Maximum text length for rendered node namesshowCode: Toggle whether source code is showncode: JavaScript source code to visualize
Item props (Fusion):
label: Read from node propertylabel; falls back to node propertytitlecode: Read from node propertycodeshowCode: Read from node propertyshowCodemaxNameLength: Read from node propertymaxNameLengthincludeJS: Whether to loadMain.jsvia Carbon.FileLoader (default:true)includeCSS: Whether to loadMain.cssvia Carbon.FileLoader (default:true)
The package auto-includes its Fusion and translation configuration.
Frontend Build And Development
Available scripts:
pnpm lint pnpm css pnpm js pnpm build pnpm start
What they do:
lint: Runs ESLint for JS and Stylelint for PostCSScss: CompilesResources/Private/Fusion/Main.pcsstoResources/Public/Main.cssjs: BundlesResources/Private/Fusion/Main.jstoResources/Public/Main.jsbuild: Runs CSS and JS buildsstart: Alias forbuild
Project Structure
Configuration/NodeTypes.Content.yaml: Public content node typeConfiguration/NodeTypes.Mixin.Item.yaml: Inspector properties and UI configResources/Private/Fusion/Integration/Item.fusion: Node integrationResources/Private/Fusion/Presentation/FlowChart.fusion: Render componentResources/Private/Fusion/Main.js: Flowchart + highlight runtime logicResources/Private/Fusion/Main.pcss: Styling sourceResources/Public/Main.js: Built JavaScript assetResources/Public/Main.css: Built CSS asset
License
GPL-3.0