infog-cli
v0.0.2
Published
Instantly create stunning SVG infographics from simple declarative syntax. Render from strings, files, or stdin.
Downloads
242
Maintainers
Readme
infog-cli
Command-line interface for AntV Infographic - instantly create stunning SVG infographics from simple declarative syntax. Render from strings, files, or stdin.
Quick Start
# Install
npm install -g infog-cli
# Render from string (quickest for testing)
ifgc -s "infographic list-row-simple-horizontal-arrow
data
title My First Infographic
items
- label Step 1
- label Step 2" -o output.svg
# Render from file
ifgc -i input.ifgc -o output.svg
# List available templates
ifgc templateInstallation
npm install -g infog-cliThis installs two commands: ifgc (short) and infographic (long).
Usage
Basic Rendering
# From string (quickest for testing)
ifgc -s "infographic list-row-simple-horizontal-arrow
data
title My Chart
items
- label Item 1" -o output.svg
# From file (output defaults to input.svg)
ifgc -i input.ifgc
# Specify output file
ifgc -i input.ifgc -o output.svg
# From stdin
echo '...' | ifgc -o output.svg
# From stdin with file input
cat input.ifgc | ifgc -o output.svgOptions
| Option | Description |
|--------|-------------|
| -s, --string <content> | Input .ifgc content as a string |
| -i, --input <file> | Input .ifgc file |
| -o, --output <file> | Output file (default: input.svg) |
| -f, --format <format> | Output format: png or svg (default: png) |
| --background <color> | Background color (default: transparent) |
| -c, --config <file> | JSON configuration file |
| -t, --theme <name> | Theme name |
| -q, --quiet | Suppress log output |
| --remote-api-host <url> | Remote API host for SVG to PNG conversion (required when format is png) |
List Templates
ifgc templateVisit AntV Infographic to see template previews.
Examples
Example 1: Simple Step List
cat > steps.ifgc << EOF
infographic list-row-simple-horizontal-arrow
data
title Getting Started
desc Three simple steps to begin
items
- label Step 1
desc Install the package
- label Step 2
desc Create your first infographic
- label Step 3
desc Export and share
EOF
ifgc -i steps.ifgc -o steps.svgExample 2: Timeline
cat > timeline.ifgc << EOF
infographic timeline-horizontal-basic-date
data
title Project Roadmap
items
- label Q1
desc Planning
- label Q2
desc Development
- label Q3
desc Testing
- label Q4
desc Launch
EOF
ifgc -i timeline.ifgc -o timeline.svgExample 3: Using Theme
cat > swot.ifgc << EOF
infographic compare-quadrant-four-areas-card
data
title SWOT Analysis
items
- label Strengths
desc Internal advantages
- label Weaknesses
desc Internal limitations
- label Opportunities
desc External possibilities
- label Threats
desc External risks
EOF
ifgc -i swot.ifgc -o swot.svg -t darkExample 4: From stdin
echo 'infographic list-row-simple-horizontal-arrow
data
title Quick Tasks
items
- label Task A
- label Task B
- label Task C' | ifgc -o tasks.svgOutput Format
SVG
Infographic is a vector graphics format, perfect for:
- Web use - Scalable, interactive, small file size
- Documentation - GitHub, GitLab, Notion, etc.
- Design tools - Figma, Sketch, Illustrator
- Code documentation - Docusaurus, VitePress, etc.
PNG
PNG output requires a remote SVG-to-PNG conversion API. Provide the API host with --remote-api-host:
ifgc -i input.ifgc -o output.png --remote-api-host https://api.example.comThe remote API must expose a POST /convert/svg-to-png endpoint that accepts a multipart/form-data upload with an SVG file and returns a PNG image.
Infographic Syntax
Learn more about the declarative infographic syntax at antvis/Infographic.
See Also
- AntV Infographic - The core library
- Infographic Documentation - Official documentation
- Infographic Editor - Online examples
License
MIT © 2026 HK-Zhang
Changelog
See CHANGELOG.md for a list of changes in each version.
