{"id":16856393,"url":"https://github.com/vallentin/pygmentize","last_synced_at":"2025-03-18T11:14:18.449Z","repository":{"id":160001635,"uuid":"634932192","full_name":"vallentin/pygmentize","owner":"vallentin","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-14T15:17:18.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T09:11:16.546Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vallentin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-01T15:23:00.000Z","updated_at":"2023-05-01T19:02:05.000Z","dependencies_parsed_at":"2023-06-18T14:09:32.574Z","dependency_job_id":null,"html_url":"https://github.com/vallentin/pygmentize","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2Fpygmentize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2Fpygmentize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2Fpygmentize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2Fpygmentize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vallentin","download_url":"https://codeload.github.com/vallentin/pygmentize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244207746,"owners_count":20416109,"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":[],"created_at":"2024-10-13T14:04:06.913Z","updated_at":"2025-03-18T11:14:18.443Z","avatar_url":"https://github.com/vallentin.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pygmentize\n\n[![Latest Version](https://img.shields.io/crates/v/pygmentize.svg)](https://crates.io/crates/pygmentize)\n[![Docs](https://docs.rs/pygmentize/badge.svg)](https://docs.rs/pygmentize)\n![Pygmentize Version](https://img.shields.io/badge/pygmentize-2.15.1-blue)\n[![License](https://img.shields.io/github/license/vallentin/pygmentize.svg)](https://github.com/vallentin/pygmentize)\n\nRust library and wrapper around the [pygmentize](https://pygments.org/docs/cmdline/) CLI. Apply syntax highlighting to over 500 languages and other text formatted. Render into HTML, SVG, LaTeX, and Terminal (ANSI color sequences).\n\n## Rendered HTML Output\n\n_Rendered example of [examples/html.rs](https://github.com/vallentin/pygmentize/blob/master/examples/html.rs)._\n\n![Rendered Example](https://github.com/vallentin/pygmentize/assets/17464404/feedd372-9f36-4065-bbdd-0d7082ddbc0e)\n\n## Example\n\n```rust\nuse pygmentize::{HtmlFormatter, PygmentizeError};\n\nlet code = r#\"fn main() {\n    println!(\"Hello, world!\");\n}\"#;\n\nlet html = pygmentize::highlight(code, Some(\"rust\"), \u0026HtmlFormatter::default())?;\nprintln!(\"{html}\");\n```\n\n### Output\n\n_(whitespace added to improve clarity)_\n\n```html\n\u003cdiv class=\"highlight\"\u003e\n\u003cpre\u003e\n    \u003cspan\u003e\u003c/span\u003e\n\n    \u003cspan class=\"k\"\u003efn\u003c/span\u003e\n    \u003cspan class=\"nf\"\u003emain\u003c/span\u003e\n    \u003cspan class=\"p\"\u003e()\u003c/span\u003e\n    \u003cspan class=\"w\"\u003e \u003c/span\u003e\n    \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\n    \u003cspan class=\"w\"\u003e    \u003c/span\u003e\n    \u003cspan class=\"fm\"\u003eprintln!\u003c/span\u003e\n    \u003cspan class=\"p\"\u003e(\u003c/span\u003e\n    \u003cspan class=\"s\"\u003e\u0026quot;Hello, world!\u0026quot;\u003c/span\u003e\n    \u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\n    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n```\n\n### Rendered\n\n_(with the [Dracula theme](https://draculatheme.com))_\n\n![Rendered Example 2](https://user-images.githubusercontent.com/17464404/235512548-76086e98-dd04-4cff-90ab-e3cfde0d206c.png)\n\n### Override Pygmentize Path\n\nThe path to the `pygmentize` binary, can be overridden using `pygmentize::`[`set_bin_path()`](https://docs.rs/pygmentize/*/pygmentize/fn.set_bin_path.html). The default path is `\"pygmentize\"`.\n\nIf `pygmentize` is installed in a virtual environment, within your crate directory,\ni.e. `Cargo.lock` and `env/` being within the same directory. Then assuming that\nthe current directory is the same. Then the path can be overridden by doing:\n\n```rust\npygmentize::set_bin_path(\"./env/Scripts/pygmentize\");\n```\n\n## Install\n\nThe library is a wrapper around the [pygmentize](https://pygments.org/docs/cmdline/) CLI,\nand as such it must be available in the system PATH. The easiest way to install\n[pygmentize](https://pygments.org/docs/cmdline/) is through Python.\n\n```console\npip install Pygments\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvallentin%2Fpygmentize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvallentin%2Fpygmentize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvallentin%2Fpygmentize/lists"}