{"id":13517215,"url":"https://github.com/googlearchive/code-prettify","last_synced_at":"2025-09-28T19:31:18.152Z","repository":{"id":30850799,"uuid":"34408310","full_name":"googlearchive/code-prettify","owner":"googlearchive","description":"An embeddable script that makes source-code snippets in HTML prettier.","archived":true,"fork":false,"pushed_at":"2020-04-21T16:43:49.000Z","size":16845,"stargazers_count":5787,"open_issues_count":227,"forks_count":890,"subscribers_count":204,"default_branch":"master","last_synced_at":"2025-09-15T15:06:16.287Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/googlearchive.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-22T18:32:17.000Z","updated_at":"2025-09-13T10:50:31.000Z","dependencies_parsed_at":"2022-07-12T23:10:33.636Z","dependency_job_id":null,"html_url":"https://github.com/googlearchive/code-prettify","commit_stats":null,"previous_names":["google/code-prettify"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/googlearchive/code-prettify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlearchive%2Fcode-prettify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlearchive%2Fcode-prettify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlearchive%2Fcode-prettify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlearchive%2Fcode-prettify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/googlearchive","download_url":"https://codeload.github.com/googlearchive/code-prettify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlearchive%2Fcode-prettify/sbom","scorecard":{"id":436618,"data":{"date":"2025-08-11","repo":{"name":"github.com/googlearchive/code-prettify","commit":"e006587b4a893f0281e9dc9a53001c7ed584d4e7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":7,"reason":"Found 15/19 approved changesets -- score normalized to 7","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: COPYING:0","Info: FSF or OSI recognized license: Apache License 2.0: COPYING:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact 2013-03-04 not signed: https://api.github.com/repos/googlearchive/code-prettify/releases/4948269","Warn: release artifact 2013-02-25 not signed: https://api.github.com/repos/googlearchive/code-prettify/releases/4948263","Warn: release artifact 2011-06-01 not signed: https://api.github.com/repos/googlearchive/code-prettify/releases/4948260","Warn: release artifact 2010-07-21 not signed: https://api.github.com/repos/googlearchive/code-prettify/releases/4948257","Warn: release artifact 2009-12-03 not signed: https://api.github.com/repos/googlearchive/code-prettify/releases/4948253","Warn: release artifact 2013-03-04 does not have provenance: https://api.github.com/repos/googlearchive/code-prettify/releases/4948269","Warn: release artifact 2013-02-25 does not have provenance: https://api.github.com/repos/googlearchive/code-prettify/releases/4948263","Warn: release artifact 2011-06-01 does not have provenance: https://api.github.com/repos/googlearchive/code-prettify/releases/4948260","Warn: release artifact 2010-07-21 does not have provenance: https://api.github.com/repos/googlearchive/code-prettify/releases/4948257","Warn: release artifact 2009-12-03 does not have provenance: https://api.github.com/repos/googlearchive/code-prettify/releases/4948253"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T04:50:08.418Z","repository_id":30850799,"created_at":"2025-08-19T04:50:08.418Z","updated_at":"2025-08-19T04:50:08.418Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277295924,"owners_count":25794402,"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","status":"online","status_checked_at":"2025-09-27T02:00:08.978Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-08-01T05:01:31.209Z","updated_at":"2025-09-28T19:31:17.849Z","avatar_url":"https://github.com/googlearchive.png","language":"JavaScript","readme":"# Status: Archived\n\n![status: inactive](https://img.shields.io/badge/status-inactive-red.svg)\n\nThis repository has been archived and is no longer maintained.\n\n---\n\n# JavaScript code prettifier\n\nAnnouncement: [**Action required** *rawgit.com* is going away](https://groups.google.com/forum/#!topic/js-code-prettifier/IFHev_kLm30).\n\nAn embeddable script that makes source-code snippets in HTML prettier.\n\n* Works on HTML pages.\n* Works even if code contains embedded links, line numbers, etc.\n* Simple API: include some JS \u0026 CSS and add an onload handler.\n* Lightweights: small download and does not block page from loading while\n  running.\n* Customizable styles via CSS. See the [themes gallery][1].\n* Supports all C-like, Bash-like, and XML-like languages. No need to specify\n  the language.\n* Extensible language handlers for other languages. You can specify the\n  language.\n* Widely used with good cross-browser support. Powers https://code.google.com/\n  and http://stackoverflow.com/\n\n[See an example][2].\n\n## Setup\n\n * Include the script tag below in your document:\n```HTML\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js\"\u003e\u003c/script\u003e\n```\n * See [Getting Started](docs/getting_started.md) to configure that URL with\n   options you need.\n * Look at the [skin gallery][1] and pick styles that suit you.\n\n## Usage\n\nPut code snippets in `\u003cpre class=\"prettyprint\"\u003e...\u003c/pre\u003e` or\n`\u003ccode class=\"prettyprint\"\u003e...\u003c/code\u003e` and it will automatically be\npretty-printed.\n\n```HTML\n\u003cpre class=\"prettyprint\"\u003eclass Voila {\npublic:\n  // Voila\n  static const string VOILA = \"Voila\";\n\n  // will not interfere with embedded \u003ca href=\"#voila2\"\u003etags\u003c/a\u003e.\n}\u003c/pre\u003e\n```\n\n## FAQ\n\n### For which languages does it work?\n\nThe comments in `prettify.js` are authoritative but the lexer should work on a\nnumber of languages including C and friends, Java, Python, Bash, SQL, HTML,\nXML, CSS, JavaScript, Makefile, and Rust.\n\nIt works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl and\nRuby, but because of commenting conventions, doesn't work on Smalltalk, OCaml,\netc. without a language extension.\n\nOther languages are supported via extensions:\n\n[Apollo](src/lang-apollo.js);\n[Basic](src/lang-basic.js);\n[Clojure](src/lang-clj.js);\n[CSS](src/lang-css.js);\n[Dart](src/lang-dart.js);\n[Erlang](src/lang-erlang.js);\n[Go](src/lang-go.js);\n[Haskell](src/lang-hs.js);\n[Lasso](src/lang-lasso.js);\n[Lisp, Scheme](src/lang-lisp.js);\n[LLVM](src/lang-llvm.js);\n[Logtalk](src/lang-logtalk.js);\n[Lua](src/lang-lua.js);\n[MATLAB](src/lang-matlab.js);\n[MLs: F#, Ocaml,SML](src/lang-ml.js);\n[Mumps](src/lang-mumps.js);\n[Nemerle](src/lang-n.js);\n[Pascal](src/lang-pascal.js);\n[Protocol buffers](src/lang-proto.js);\n[R, S](src/lang-r.js);\n[RD](src/lang-rd.js);\n[Rust](src/lang-rust.js);\n[Scala](src/lang-scala.js);\n[SQL](src/lang-sql.js);\n[Swift](src/lang-swift.js);\n[TCL](src/lang-tcl.js);\n[LaTeX](src/lang-tex.js);\n[Visual Basic](src/lang-vb.js);\n[VHDL](src/lang-vhdl.js);\n[Wiki](src/lang-wiki.js);\n[XQ](src/lang-xq.js);\n[YAML](src/lang-yaml.js)\n\nIf you'd like to add an extension for your favorite language, please look at\n`src/lang-lisp.js` and submit a pull request.\n\n### How do I specify the language of my code?\n\nYou don't need to specify the language since `PR.prettyPrint()` will guess.\nYou can specify a language by specifying the language extension along with the\n`prettyprint` class:\n\n```HTML\n\u003cpre class=\"prettyprint lang-html\"\u003e\n  The lang-* class specifies the language file extensions.\n  File extensions supported by default include:\n    \"bsh\", \"c\", \"cc\", \"cpp\", \"cs\", \"csh\", \"cyc\", \"cv\", \"htm\", \"html\", \"java\",\n    \"js\", \"m\", \"mxml\", \"perl\", \"pl\", \"pm\", \"py\", \"rb\", \"sh\", \"xhtml\", \"xml\",\n    \"xsl\".\n\u003c/pre\u003e\n```\n\nYou may also use the [HTML 5][3] convention of embedding a `\u003ccode\u003e` element\ninside the `\u003cpre\u003e` and using `language-java` style classes:\n\n```HTML\n\u003cpre class=\"prettyprint\"\u003e\u003ccode class=\"language-java\"\u003e...\u003c/code\u003e\u003c/pre\u003e\n```\n\n### It doesn't work on \"obfuscated code sample\"?\n\nYes. Prettifying obfuscated code is like putting lipstick on a pig \u0026mdash;\ni.e. outside the scope of this tool.\n\n### Which browsers does it work with?\n\nIt's been tested with IE 6, Firefox 1.5 \u0026 2, and Safari 2.0.4. Look at\n[the tests][4] to see if it works in your browser.\n\n### What's changed?\n\nSee the [changelog](CHANGES.md).\n\n### Why doesn't Prettyprinting of strings work on WordPress?\n\nApparently wordpress does \"smart quoting\" which changes close quotes.  This\ncauses end quotes to not match up with open quotes.\n\nThis breaks prettifying as well as copying and pasting of code samples.  See\n[WordPress's help center][5] for info on how to stop smart quoting of code\nsnippets.\n\n### How do I put line numbers in my code?\n\nYou can use the `linenums` class to turn on line numbering.  If your code\ndoesn't start at line number `1`, you can add a colon and a line number to the\nend of that class as in `linenums:52`. For example:\n\n```HTML\n\u003cpre class=\"prettyprint linenums:4\"\n\u003e// This is line 4.\nfoo();\nbar();\nbaz();\nboo();\nfar();\nfaz();\n\u003c/pre\u003e\n```\n\n### How do I prevent a portion of markup from being marked as code?\n\nYou can use the `nocode` class to identify a span of markup that is not code:\n\n```HTML\n\u003cpre class=\"prettyprint\"\u003e\nint x = foo();  /* This is a comment  \u003cspan class=\"nocode\"\u003eThis is not code\u003c/span\u003e\n  Continuation of comment */\nint y = bar();\n\u003c/pre\u003e\n```\n\nFor a more complete example see the [issue #22 testcase][6].\n\n### I get an error message \"a is not a function\" or \"opt_whenDone is not a function\"\n\nIf you are calling `prettyPrint` via an event handler, wrap it in a function.\nInstead of doing:\n\n```JavaScript\naddEventListener('load', PR.prettyPrint, false);\n```\n\nwrap it in a closure like:\n\n```JavaScript\naddEventListener('load', function(event) { PR.prettyPrint(); }, false);\n```\n\nso that the browser does not pass an event object to `PR.prettyPrint`\nwhich will confuse it.\n\n### How can I customize the colors and styles of my code?\n\nPrettify adds `\u003cspan\u003e` with `class`es describing the kind of code.  You can\ncreate CSS styles to matches these classes.\n\nSee the [theme gallery][1] for examples.\n\n### I can't add classes to my code (because it comes from Markdown, etc.)\n\nInstead of `\u003cpre class=\"prettyprint ...\"\u003e` you can use a comment or processing\ninstructions that survives processing instructions: `\u003c?prettify ...?\u003e` works\nas explained in [Getting Started](docs/getting_started.md).\n\n### How can I put line numbers on every line instead of just every fifth line?\n\nPrettify puts lines into an HTML list element so that line numbers aren't\ncaught by copy/paste, and the line numbering is controlled by CSS in the\ndefault stylesheet, `prettify.css`.\n\nThe following should turn line numbering back on for the other lines:\n\n```HTML\n\u003cstyle\u003e\nli.L0, li.L1, li.L2, li.L3,\nli.L5, li.L6, li.L7, li.L8 {\n  list-style-type: decimal !important;\n}\n\u003c/style\u003e\n```\n\n## Discussion\n\nPlease use the official [support group][7] for discussions, suggestions, and\ngeneral feedback.\n\n## License\n\n[Apache License 2.0](COPYING)\n\n\n[1]: https://raw.githack.com/google/code-prettify/master/styles/index.html\n[2]: https://raw.githack.com/google/code-prettify/master/examples/quine.html\n[3]: http://dev.w3.org/html5/spec-author-view/the-code-element.html#the-code-element\n[4]: https://raw.githack.com/google/code-prettify/master/tests/prettify_test.html\n[5]: http://wordpress.org/support/topic/125038\n[6]: https://raw.githack.com/google/code-prettify/master/tests/prettify_test.html#issue22\n[7]: http://groups.google.com/group/js-code-prettifier\n","funding_links":[],"categories":["JavaScript","📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglearchive%2Fcode-prettify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglearchive%2Fcode-prettify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglearchive%2Fcode-prettify/lists"}