npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

prettycode

v1.1.1

Published

prettycode is a simple software to covert code into pdf

Downloads

4

Readme

prettycode

prettycode is a software to pretty print code into a pdf file. It has a library and an executable:

Installation

Clone the repo, install the node dependencies and you are good to go

git clone [email protected]:luxedo/prettycode.git
cd prettycode
npm install
./prettycode FILES

Or you can install via npm

npm install prettycode

Usage

prettycode(fileName, [options])

Options:

  • style: Choses the stylesheet to use (list below). Default: github.
  • encoding: Selects the encoding. Default: UTF-8.
  • language: Selects the language to apply highlight. Default: Autodetect.
  • addHeader: Adds a message to the header of the file. Eg: version number.
  • addFooter: Adds a message to the footer of the file. Eg: version number.
  • output: Chooses the output folder. Default: .

Example:

const pc = require("prettycode")

const opts = {
  style: "github",
  addHeader: "<h1>My Nice File</h1>"
}
pc("myFile.py", "myFile.py.pdf", opts)
.then(err => {
  if (err) throw err
  console.log("Done!");
})

The executable has the following options:

Usage: prettycode [-h | -v | -s style | -e encoding | -l language | -a message | -o output_folder] FILES
Converts code into a pretty formated pdf with syntax highlight

Arguments:
  -h, --help        Show this help.
  -v, --version     Shows the software version.
  -s, --style       Choses the stylesheet to use (list below). Default: github.
  -e, --encoding    Selects the encoding. Default: UTF-8.
  -l, --language    Selects the language to apply highlight. Default: Autodetect.
  -a, --add-header  Adds a message to the header of the file. Eg: version number. You can use HTML.
  -f, --add-footer  Adds a message to the footer of the file. Eg: version number. You can use HTML.
  -o, --output      Chooses the output folder. Default: .

Running the program passing itself as argument prints the source code:

$ prettycode -a "<b>Preetycode Source</b>" prettycode

or:

const pc = require("prettycode");

const opts = {
  addHeader: "<b>Preetycode Source</b>"
};
pc("prettycode", opts)
.then(err => {
  if (err) throw err;
  console.log("Done!");
});

Generated prettycode.pdf:

example

Avaliable Stylesheets

The styles used for rendering were taken from highlight.js. Check their demo for examples.

  • a11y-dark
  • a11y-light
  • agate
  • an-old-hope
  • androidstudio
  • arduino-light
  • arta
  • ascetic
  • atelier-cave-dark
  • atelier-cave-light
  • atelier-dune-dark
  • atelier-dune-light
  • atelier-estuary-dark
  • atelier-estuary-light
  • atelier-forest-dark
  • atelier-forest-light
  • atelier-heath-dark
  • atelier-heath-light
  • atelier-lakeside-dark
  • atelier-lakeside-light
  • atelier-plateau-dark
  • atelier-plateau-light
  • atelier-savanna-dark
  • atelier-savanna-light
  • atelier-seaside-dark
  • atelier-seaside-light
  • atelier-sulphurpool-dark
  • atelier-sulphurpool-light
  • atom-one-dark-reasonable
  • atom-one-dark
  • atom-one-light
  • brown-paper
  • codepen-embed
  • color-brewer
  • darcula
  • dark
  • darkula
  • default
  • docco
  • dracula
  • far
  • foundation
  • github-gist
  • github
  • gml
  • googlecode
  • grayscale
  • gruvbox-dark
  • gruvbox-light
  • hopscotch
  • hybrid
  • idea
  • ir-black
  • isbl-editor-dark
  • isbl-editor-light
  • kimbie.dark
  • kimbie.light
  • lightfair
  • magula
  • mono-blue
  • monokai-sublime
  • monokai
  • nord
  • obsidian
  • ocean
  • paraiso-dark
  • paraiso-light
  • pojoaque
  • purebasic
  • qtcreator_dark
  • qtcreator_light
  • railscasts
  • rainbow
  • routeros
  • school-book
  • shades-of-purple
  • solarized-dark
  • solarized-light
  • sunburst
  • tomorrow-night-blue
  • tomorrow-night-bright
  • tomorrow-night-eighties
  • tomorrow-night
  • tomorrow
  • vs
  • vs2015
  • xcode
  • xt256
  • zenburn

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.