{"id":18853128,"url":"https://github.com/luxedo/prettycode","last_synced_at":"2026-02-04T20:30:15.521Z","repository":{"id":57330192,"uuid":"61823668","full_name":"luxedo/prettycode","owner":"luxedo","description":"Preetycode is a simple software to covert code into pdf","archived":false,"fork":false,"pushed_at":"2019-01-07T14:59:45.000Z","size":665,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T07:19:23.740Z","etag":null,"topics":["code","highlight","pdf","print","print-code","shell"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/prettycode","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luxedo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-23T17:23:39.000Z","updated_at":"2022-03-06T21:03:41.000Z","dependencies_parsed_at":"2022-09-21T02:20:46.799Z","dependency_job_id":null,"html_url":"https://github.com/luxedo/prettycode","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luxedo%2Fprettycode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luxedo%2Fprettycode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luxedo%2Fprettycode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luxedo%2Fprettycode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luxedo","download_url":"https://codeload.github.com/luxedo/prettycode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239793056,"owners_count":19697893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code","highlight","pdf","print","print-code","shell"],"created_at":"2024-11-08T03:43:02.631Z","updated_at":"2026-02-04T20:30:15.493Z","avatar_url":"https://github.com/luxedo.png","language":"JavaScript","readme":"# prettycode\n`prettycode` is a software to pretty print code into a `pdf` file. It has a library\nand an executable:\n\n## Installation\nClone the repo, install the node dependencies and you are good to go\n```bash\ngit clone git@github.com:luxedo/prettycode.git\ncd prettycode\nnpm install\n./prettycode FILES\n```\nOr you can install via `npm`\n```bash\nnpm install prettycode\n```\n\n## Usage\n### `prettycode(fileName, [options])`\n#### Options:\n-   `style`: Choses the stylesheet to use (list below). Default: github.\n-   `encoding`: Selects the encoding. Default: UTF-8.\n-   `language`: Selects the language to apply highlight. Default: Autodetect.\n-   `addHeader`: Adds a message to the header of the file. Eg: version number.\n-   `addFooter`:  Adds a message to the footer of the file. Eg: version number.\n-   `output`: Chooses the output folder. Default: `.`\n\nExample:\n```javascript\nconst pc = require(\"prettycode\")\n\nconst opts = {\n  style: \"github\",\n  addHeader: \"\u003ch1\u003eMy Nice File\u003c/h1\u003e\"\n}\npc(\"myFile.py\", \"myFile.py.pdf\", opts)\n.then(err =\u003e {\n  if (err) throw err\n  console.log(\"Done!\");\n})\n```\n\nThe executable has the following options:\n```\nUsage: prettycode [-h | -v | -s style | -e encoding | -l language | -a message | -o output_folder] FILES\nConverts code into a pretty formated pdf with syntax highlight\n\nArguments:\n  -h, --help        Show this help.\n  -v, --version     Shows the software version.\n  -s, --style       Choses the stylesheet to use (list below). Default: github.\n  -e, --encoding    Selects the encoding. Default: UTF-8.\n  -l, --language    Selects the language to apply highlight. Default: Autodetect.\n  -a, --add-header  Adds a message to the header of the file. Eg: version number. You can use HTML.\n  -f, --add-footer  Adds a message to the footer of the file. Eg: version number. You can use HTML.\n  -o, --output      Chooses the output folder. Default: .\n```\n\nRunning the program passing itself as argument prints the source code:\n```sh\n$ prettycode -a \"\u003cb\u003ePreetycode Source\u003c/b\u003e\" prettycode\n```\nor:\n```javascript\nconst pc = require(\"prettycode\");\n\nconst opts = {\n  addHeader: \"\u003cb\u003ePreetycode Source\u003c/b\u003e\"\n};\npc(\"prettycode\", opts)\n.then(err =\u003e {\n  if (err) throw err;\n  console.log(\"Done!\");\n});\n```\nGenerated `prettycode.pdf`:\n\n![example](docs/prettycode_example.png)\n\n## Avaliable Stylesheets\nThe styles used for rendering were taken from [highlight.js](https://highlightjs.org/).\nCheck their [demo](https://highlightjs.org/static/demo/) for examples.\n\n-   a11y-dark\n-   a11y-light\n-   agate\n-   an-old-hope\n-   androidstudio\n-   arduino-light\n-   arta\n-   ascetic\n-   atelier-cave-dark\n-   atelier-cave-light\n-   atelier-dune-dark\n-   atelier-dune-light\n-   atelier-estuary-dark\n-   atelier-estuary-light\n-   atelier-forest-dark\n-   atelier-forest-light\n-   atelier-heath-dark\n-   atelier-heath-light\n-   atelier-lakeside-dark\n-   atelier-lakeside-light\n-   atelier-plateau-dark\n-   atelier-plateau-light\n-   atelier-savanna-dark\n-   atelier-savanna-light\n-   atelier-seaside-dark\n-   atelier-seaside-light\n-   atelier-sulphurpool-dark\n-   atelier-sulphurpool-light\n-   atom-one-dark-reasonable\n-   atom-one-dark\n-   atom-one-light\n-   brown-paper\n-   codepen-embed\n-   color-brewer\n-   darcula\n-   dark\n-   darkula\n-   default\n-   docco\n-   dracula\n-   far\n-   foundation\n-   github-gist\n-   github\n-   gml\n-   googlecode\n-   grayscale\n-   gruvbox-dark\n-   gruvbox-light\n-   hopscotch\n-   hybrid\n-   idea\n-   ir-black\n-   isbl-editor-dark\n-   isbl-editor-light\n-   kimbie.dark\n-   kimbie.light\n-   lightfair\n-   magula\n-   mono-blue\n-   monokai-sublime\n-   monokai\n-   nord\n-   obsidian\n-   ocean\n-   paraiso-dark\n-   paraiso-light\n-   pojoaque\n-   purebasic\n-   qtcreator_dark\n-   qtcreator_light\n-   railscasts\n-   rainbow\n-   routeros\n-   school-book\n-   shades-of-purple\n-   solarized-dark\n-   solarized-light\n-   sunburst\n-   tomorrow-night-blue\n-   tomorrow-night-bright\n-   tomorrow-night-eighties\n-   tomorrow-night\n-   tomorrow\n-   vs\n-   vs2015\n-   xcode\n-   xt256\n-   zenburn\n\n## License\nThis 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.\n\nThis 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.\n\nYou should have received a copy of the GNU General Public License along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluxedo%2Fprettycode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluxedo%2Fprettycode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluxedo%2Fprettycode/lists"}