{"id":24983663,"url":"https://github.com/posthtml/posthtml-prism","last_synced_at":"2025-06-25T14:35:04.452Z","repository":{"id":38844214,"uuid":"248780159","full_name":"posthtml/posthtml-prism","owner":"posthtml","description":"PostHTML plugin for code syntax highlighting with Prism.","archived":false,"fork":false,"pushed_at":"2024-08-30T11:02:52.000Z","size":1910,"stargazers_count":11,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-05T06:55:16.105Z","etag":null,"topics":["code-highlight","highlight","posthtml-plugin","prismjs","syntax-highlighting"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/posthtml.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://mailviews.com"]}},"created_at":"2020-03-20T14:48:52.000Z","updated_at":"2024-07-02T14:06:43.000Z","dependencies_parsed_at":"2024-04-14T22:02:54.029Z","dependency_job_id":"bf6db979-4482-4293-8657-1f53755a7153","html_url":"https://github.com/posthtml/posthtml-prism","commit_stats":{"total_commits":85,"total_committers":6,"mean_commits":"14.166666666666666","dds":0.5176470588235293,"last_synced_commit":"8c5fc0672f0467830f9c37af1af8c6a4decb11c4"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/posthtml/posthtml-prism","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-prism","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-prism/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-prism/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-prism/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/posthtml-prism/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-prism/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259748044,"owners_count":22905439,"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","highlight","posthtml-plugin","prismjs","syntax-highlighting"],"created_at":"2025-02-04T09:20:15.153Z","updated_at":"2025-06-25T14:35:04.425Z","avatar_url":"https://github.com/posthtml.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"150\" height=\"150\" title=\"PostHTML\" src=\"https://posthtml.github.io/posthtml/logo.svg\"\u003e\n  \u003ch1\u003ePrism Syntax Highlighting\u003c/h1\u003e\n\n  Compile-time syntax highlighting for code blocks with [Prism](https://prismjs.com/)\n\n  [![Version][npm-version-shield]][npm]\n  [![Build][github-ci-shield]][github-ci]\n  [![License][license-shield]][license]\n  [![Downloads][npm-stats-shield]][npm-stats]\n\u003c/div\u003e\n\n## Introduction\n\nBefore:\n\n```html\n\u003cpre\u003e\u003ccode class=\"language-javascript\"\u003e\n  const foo = 'bar'\n  console.log(foo)\n\u003c/code\u003e\u003c/pre\u003e\n```\n\nAfter:\n\n```html\n\u003cpre\u003e\u003ccode class=\"language-javascript\"\u003e\n  \u003cspan class=\"token keyword\"\u003econst\u003c/span\u003e foo \u003cspan class=\"token operator\"\u003e=\u003c/span\u003e \u003cspan class=\"token string\"\u003e'bar'\u003c/span\u003e\n  console\u003cspan class=\"token punctuation\"\u003e.\u003c/span\u003e\u003cspan class=\"token function\"\u003elog\u003c/span\u003e\u003cspan class=\"token punctuation\"\u003e(\u003c/span\u003efoo\u003cspan class=\"token punctuation\"\u003e)\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n```\n\n## Install\n\n```\n$ npm i posthtml posthtml-prism\n```\n\n## Usage\n\n```js\nconst fs = require('fs')\nconst posthtml = require('posthtml')\nconst highlight = require('posthtml-prism')\n\nconst source = fs.readFileSync('./before.html')\n\nposthtml([\n    highlight({ inline: true  })\n  ])\n  .process(source)\n  .then(result =\u003e fs.writeFileSync('./after.html', result.html))\n```\n\n## Options\n\n### inline \n\nType: `boolean`\\\nDefault: `false`\n\nBy default, only `\u003ccode\u003e` tags wrapped in `\u003cpre\u003e` tags are highlighted. \n\nPass in `inline: true` to highlight all code tags.\n\n## Styling\n\nYou will also need to include a Prism theme stylesheet in your HTML. \n\nSee [PrismJS/prism-themes](https://github.com/PrismJS/prism-themes) for all available themes.\n\n## Languages\n\nBy default, Prism loads the following languages: `markup`, `css`, `clike`, and `javascript`.\n\nYou can specify the language to be used for highlighting your code, by adding a `language-*` or `lang-*` class to the `\u003ccode\u003e` tag:\n\n```html\n\u003cpre\u003e\n  \u003ccode class=\"language-php\"\u003e\n    $app-\u003epost('framework/{id}', function($framework) {        \n      $this-\u003edispatch(new Energy($framework));\n    });\n  \u003c/code\u003e\n\u003c/pre\u003e\n```\n\n### Skip highlighting on a node\n\nYou can skip highlighting on a node in two ways:\n\n1. add a `prism-ignore` attribute on the node:\n  ```html\n  \u003cpre\u003e\n    \u003ccode prism-ignore\u003e...\u003c/code\u003e\n  \u003c/pre\u003e\n  ```\n\n2. or, add a `prism-ignore` class:\n  ```html\n  \u003cpre\u003e\n    \u003ccode class=\"prism-ignore\"\u003e...\u003c/code\u003e\n  \u003c/pre\u003e\n  ```\n\nIn both cases, the `prism-ignore` attribute/class will be removed and highlighting will be skipped.\n\n[npm]: https://www.npmjs.com/package/posthtml-prism\n[npm-version-shield]: https://img.shields.io/npm/v/posthtml-prism.svg\n[npm-stats]: http://npm-stat.com/charts.html?package=posthtml-prism\u0026author=\u0026from=\u0026to=\n[npm-stats-shield]: https://img.shields.io/npm/dt/posthtml-prism.svg?maxAge=2592000\n[github-ci]: https://github.com/posthtml/posthtml-prism/actions\n[github-ci-shield]: https://github.com/posthtml/posthtml-prism/actions/workflows/nodejs.yml/badge.svg\n[license]: ./license\n[license-shield]: https://img.shields.io/npm/l/posthtml-prism.svg\n","funding_links":["https://mailviews.com"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-prism","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fposthtml-prism","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-prism/lists"}