md-code-image-cli
v0.1.5
Published
Generate syntax-highlighted PNG images from Markdown fenced code blocks.
Maintainers
Readme
md-code-image-cli
Generate syntax-highlighted PNG images from Markdown fenced code blocks in pure Node.js.
Built-in font fallback covers Latin code text and Simplified Chinese comments/strings.
The published package vendors the runtime fonts it needs. Font license notices are included in LICENSES/.
Requirements
- Node.js 18+
Install
npm installFrom npm:
npm install -g md-code-image-cliBuild
npm run buildUsage
node dist/cli/index.js input.mdInstalled globally:
md-code-image input.mdOr in development:
npm run dev -- input.mdOptions
--out <path>: output directory, default./output--theme <theme>: Shiki theme, defaultgithub-dark--line-numbers: render line numbers--window <mac|none>: window chrome style, defaultnone--background <solid|gradient|transparent>: outer background, defaultsolid--padding <number>: card padding, default24--radius <number>: card radius, default12--scale <1|2|3>: PNG export scale, default2--max-width <number>: maximum card width, default800
Output
Each fenced code block is exported as a separate PNG:
output/
code-01-js.png
code-02-ts.png
code-03-bash.pngUnnamed or unsupported languages fall back to txt for filenames and plaintext highlighting for rendering.
Development
npm testPublish Notes
Local manual publish:
npm test
npm run build
npm publishprepublishOnly already runs test and build automatically.
Automated publish:
- Every push or merge into
mainbumps the patch version automatically - The workflow commits the updated
package.jsonandpackage-lock.json - The same workflow tags the release as
v<version>and publishes to npm
License
- Project code:
MIT, seeLICENSE - Bundled fonts:
SIL Open Font License 1.1, seeLICENSES/
