codesnap
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

CodeSnap

Publish Package to npmjs npm version License: MIT PRs Welcome Downloads

CodeSnap is a node.js library designed to programmatically generate images of code snippets. It provides a simple and convenient way to create beautiful snapshots of your code for further automated or programmatic usage.

Installation

To install CodeSnap, you can use npm or yarn:

npm install codesnap

or

yarn add codesnap

Usage

import CodeSnap from "codesnap";

const config = {
  theme: "Monokai",
  backgroundColor: "Cyan",
  numberLines: true,
};

const codeSnap = new CodeSnap(config);

const code = `
function greet() {
  console.log('Hello, world!');
}

greet();
`;

codeSnap.snap(code);

Configuration

The CodeSnap constructor accepts a configuration object with the following properties:

  • theme: The color theme to use for the code snippet.
  • backgroundColor: The background color of the code snippet.
  • numberLines: (Optional) A boolean value indicating whether to display line numbers.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Credits

CodeSnap is powered by Carbon.now.sh and Puppeteer.

Readme

Keywords

none

Package Sidebar

Install

npm i codesnap

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

39.2 kB

Total Files

20

Last publish

Collaborators

  • francosion042