Skip to content

Convert real code from a Github Gist into an SVG image of faux code

Notifications You must be signed in to change notification settings

knutsynstad/faux-code

Repository files navigation

faux-code

Convert real code from a Github Gist into an SVG image of faux code.

Example output

Index.js

Input:

// GitHub Gist URL
const gist = 'https://gist.github.com/knutsynstad/265226120c71426420c78c750a4eb727';

Output:

// SVG file
const filename = './fauxcode.svg';

Options:

const options = {
  theme: 'light', // 'light' or 'dark' mode
  fontSize: 5, // Line thickness and width
  leading: 10, // Space between lines
  lineCap: 'round', // Line ends 'square' or 'round'
  margin: 50, // Space between canvas edges and code block
  lineNumbers: true, // Whether or not to include line numbers
  lineNumberOffset: -3, // Line number offset from margin
};

Get up and running

Clone the repository:

git clone https://github.com/knutsynstad/faux-code.git

Install dependencies:

npm install

Run script:

npm run start

About

Convert real code from a Github Gist into an SVG image of faux code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published