1.0.1 • Published 1 year ago

carbon-now-scraper v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

carbon-now-scraper

Create a beautiful image with some Highlight With Your Codes

What's News?

  • Now With Promise so you can check If the file has finished downloading!

Argument

To use the carbon-now-scraper, 2 arguments and 1 optional are needed. Argument | Type | Needed | Description --- | --- | --- | --- code | string | Needed | Code to be used as Image output | string | Needed | Output for Image file options | object | Optional | Options to customize themes, languages, and others

Options

OptionsTypeDescriptionDefault
langstringProgram Languagesauto
themestringSet Themes for Imagedracula
backgroundstringSet Background for Imagergba(171, 184, 195, 1)
fontstringSet Font for WriteHack
window-controlsbooleanShow 3 Colored dots in the top left cornertrue
width-adjustmentbooleanAuto new line if the text is too long in 1 linetrue
linebooleanShow Line numberstrue
first-lineintFirst Line Numbers0
watermarkbooleanShow Carbon Watermarktrue

Basic Usage

With No Options

const carbon = require('carbon-now-scraper');

let code = `<?php
    echo "Hi There!";
?>`
let output = "./php.png"

carbon(code, output)

With Options

const carbon = require('carbon-now-scraper');

let code = `<?php
    echo "Hi There!";
?>`
let output = "./php.png"
let options = {
    lang: "php",
    theme: "a11y-dark"
}

carbon(code, output, options)

With Promise

const carbon = require('carbon-now-scraper');

let code = `<?php
    echo "Hi There!";
?>`
let output = "./php.png"
let options = {
    lang: "php",
    theme: "a11y-dark"
}

carbon(code, output, options).then((downloaded) => {
    console.log(`File successfully downloaded in ${downloaded}`)
})

Output: php.png

Note

  • This is Unofficial carbon.now.sh Package
  • You can use Hex Color for Background Color
  • You Can Check all Available Themes, Languages, and Font in here