|
| 1 | +# infographic-cli |
| 2 | + |
| 3 | +[](https://www.npmjs.com/package/infographic-cli) |
| 4 | +[](https://opensource.org/licenses/MIT) |
| 5 | +[](https://www.npmjs.com/package/infographic-cli) |
| 6 | + |
| 7 | +Command-line interface for [AntV Infographic](https://github.com/antvis/Infographic) - instantly create stunning SVG infographics from simple declarative syntax. Render from strings, files, or stdin. |
| 8 | + |
| 9 | +## Quick Start |
| 10 | + |
| 11 | +```bash |
| 12 | +# Install |
| 13 | +npm install -g infographic-cli |
| 14 | + |
| 15 | +# Render from string (quickest for testing) |
| 16 | +ifgc -s "infographic list-row-simple-horizontal-arrow |
| 17 | +data |
| 18 | + title My First Infographic |
| 19 | + items |
| 20 | + - label Step 1 |
| 21 | + - label Step 2" -o output.svg |
| 22 | + |
| 23 | +# Render from file |
| 24 | +ifgc -i input.ifgc -o output.svg |
| 25 | + |
| 26 | +# List available templates |
| 27 | +ifgc template |
| 28 | +``` |
| 29 | + |
| 30 | +## Installation |
| 31 | + |
| 32 | +```bash |
| 33 | +npm install -g infographic-cli |
| 34 | +``` |
| 35 | + |
| 36 | +This installs two commands: `ifgc` (short) and `infographic` (long). |
| 37 | + |
| 38 | +## Usage |
| 39 | + |
| 40 | +### Basic Rendering |
| 41 | + |
| 42 | +```bash |
| 43 | +# From string (quickest for testing) |
| 44 | +ifgc -s "infographic list-row-simple-horizontal-arrow |
| 45 | +data |
| 46 | + title My Chart |
| 47 | + items |
| 48 | + - label Item 1" -o output.svg |
| 49 | + |
| 50 | +# From file (output defaults to input.svg) |
| 51 | +ifgc -i input.ifgc |
| 52 | + |
| 53 | +# Specify output file |
| 54 | +ifgc -i input.ifgc -o output.svg |
| 55 | + |
| 56 | +# From stdin |
| 57 | +echo '...' | ifgc -o output.svg |
| 58 | + |
| 59 | +# From stdin with file input |
| 60 | +cat input.ifgc | ifgc -o output.svg |
| 61 | +``` |
| 62 | + |
| 63 | +### Options |
| 64 | + |
| 65 | +| Option | Description | |
| 66 | +|--------|-------------| |
| 67 | +| `-s, --string <content>` | Input .ifgc content as a string | |
| 68 | +| `-i, --input <file>` | Input .ifgc file | |
| 69 | +| `-o, --output <file>` | Output file (default: input.svg) | |
| 70 | +| `--background <color>` | Background color (default: transparent) | |
| 71 | +| `-c, --config <file>` | JSON configuration file | |
| 72 | +| `-t, --theme <name>` | Theme name | |
| 73 | +| `-q, --quiet` | Suppress log output | |
| 74 | + |
| 75 | +### List Templates |
| 76 | + |
| 77 | +```bash |
| 78 | +ifgc template |
| 79 | +``` |
| 80 | + |
| 81 | +Visit [AntV Infographic](https://github.com/antvis/Infographic) to see template previews. |
| 82 | + |
| 83 | +## Examples |
| 84 | + |
| 85 | +### Example 1: Simple Step List |
| 86 | + |
| 87 | +```bash |
| 88 | +cat > steps.ifgc << EOF |
| 89 | +infographic list-row-simple-horizontal-arrow |
| 90 | +data |
| 91 | + title Getting Started |
| 92 | + desc Three simple steps to begin |
| 93 | + items |
| 94 | + - label Step 1 |
| 95 | + desc Install the package |
| 96 | + - label Step 2 |
| 97 | + desc Create your first infographic |
| 98 | + - label Step 3 |
| 99 | + desc Export and share |
| 100 | +EOF |
| 101 | + |
| 102 | +ifgc -i steps.ifgc -o steps.svg |
| 103 | +``` |
| 104 | + |
| 105 | +### Example 2: Timeline |
| 106 | + |
| 107 | +```bash |
| 108 | +cat > timeline.ifgc << EOF |
| 109 | +infographic timeline-horizontal-basic-date |
| 110 | +data |
| 111 | + title Project Roadmap |
| 112 | + items |
| 113 | + - label Q1 |
| 114 | + desc Planning |
| 115 | + - label Q2 |
| 116 | + desc Development |
| 117 | + - label Q3 |
| 118 | + desc Testing |
| 119 | + - label Q4 |
| 120 | + desc Launch |
| 121 | +EOF |
| 122 | + |
| 123 | +ifgc -i timeline.ifgc -o timeline.svg |
| 124 | +``` |
| 125 | + |
| 126 | +### Example 3: Using Theme |
| 127 | + |
| 128 | +```bash |
| 129 | +cat > swot.ifgc << EOF |
| 130 | +infographic compare-quadrant-four-areas-card |
| 131 | +data |
| 132 | + title SWOT Analysis |
| 133 | + items |
| 134 | + - label Strengths |
| 135 | + desc Internal advantages |
| 136 | + - label Weaknesses |
| 137 | + desc Internal limitations |
| 138 | + - label Opportunities |
| 139 | + desc External possibilities |
| 140 | + - label Threats |
| 141 | + desc External risks |
| 142 | +EOF |
| 143 | + |
| 144 | +ifgc -i swot.ifgc -o swot.svg -t dark |
| 145 | +``` |
| 146 | + |
| 147 | +### Example 4: From stdin |
| 148 | + |
| 149 | +```bash |
| 150 | +echo 'infographic list-row-simple-horizontal-arrow |
| 151 | +data |
| 152 | + title Quick Tasks |
| 153 | + items |
| 154 | + - label Task A |
| 155 | + - label Task B |
| 156 | + - label Task C' | ifgc -o tasks.svg |
| 157 | +``` |
| 158 | + |
| 159 | +## Output Format |
| 160 | + |
| 161 | +### SVG (Default) |
| 162 | + |
| 163 | +Infographic is a vector graphics format, perfect for: |
| 164 | + |
| 165 | +- **Web use** - Scalable, interactive, small file size |
| 166 | +- **Documentation** - GitHub, GitLab, Notion, etc. |
| 167 | +- **Design tools** - Figma, Sketch, Illustrator |
| 168 | +- **Code documentation** - Docusaurus, VitePress, etc. |
| 169 | + |
| 170 | +### Converting to PNG |
| 171 | + |
| 172 | +If you need PNG for specific use cases, you can convert the SVG: |
| 173 | + |
| 174 | +**Online tools**: |
| 175 | +- [SVG to PNG](https://svgtopng.com/) |
| 176 | +- [CloudConvert](https://cloudconvert.com/svg-to-png) |
| 177 | + |
| 178 | +**Command line** (requires additional tools): |
| 179 | +- ImageMagick: `convert output.svg output.png` |
| 180 | +- Node.js with sharp: `sharp('output.svg').png().toFile('output.png')` |
| 181 | + |
| 182 | +## Infographic Syntax |
| 183 | + |
| 184 | +Learn more about the declarative infographic syntax at [antvis/Infographic](https://github.com/antvis/Infographic). |
| 185 | + |
| 186 | +## See Also |
| 187 | + |
| 188 | +- [AntV Infographic](https://github.com/antvis/Infographic) - The core library |
| 189 | +- [Infographic Documentation](https://infographic.antv.vision/) - Official documentation |
| 190 | +- [Infographic Editor](https://infographic.antv.vision/examples) - Online examples |
| 191 | + |
| 192 | +## License |
| 193 | + |
| 194 | +MIT © 2026 [lyw405](https://github.com/lyw405) |
| 195 | + |
| 196 | +## Changelog |
| 197 | + |
| 198 | +See [CHANGELOG.md](CHANGELOG.md) for a list of changes in each version. |
0 commit comments