{"id":22484455,"url":"https://github.com/rehypejs/rehype-github","last_synced_at":"2025-04-12T17:12:18.361Z","repository":{"id":159005525,"uuid":"633880867","full_name":"rehypejs/rehype-github","owner":"rehypejs","description":"rehype plugins that match how GitHub transforms markdown on their site","archived":false,"fork":false,"pushed_at":"2024-11-27T17:44:49.000Z","size":1069,"stargazers_count":28,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-12T17:12:14.211Z","etag":null,"topics":["github","hast","html","markdown","rehype","rehype-plugin"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"HTML","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/rehypejs.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},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2023-04-28T13:50:53.000Z","updated_at":"2025-03-20T19:39:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"83563527-d9ed-437e-bc60-529417cd345e","html_url":"https://github.com/rehypejs/rehype-github","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehypejs%2Frehype-github","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehypejs%2Frehype-github/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehypejs%2Frehype-github/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehypejs%2Frehype-github/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rehypejs","download_url":"https://codeload.github.com/rehypejs/rehype-github/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248602312,"owners_count":21131616,"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":["github","hast","html","markdown","rehype","rehype-plugin"],"created_at":"2024-12-06T17:11:01.372Z","updated_at":"2025-04-12T17:12:18.338Z","avatar_url":"https://github.com/rehypejs.png","language":"HTML","readme":"# rehype-github\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n**[rehype][]** plugins that match how GitHub transforms markdown on their site.\n\n\u003e 👉 **Note**:\n\u003e work in progress.\n\u003e some things are not yet finished.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Packages](#packages)\n* [Examples](#examples)\n  * [Example: comments](#example-comments)\n  * [Example: files](#example-files)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Related](#related)\n* [Contribute](#contribute)\n* [Notice](#notice)\n* [License](#license)\n\n## What is this?\n\nThis project is a monorepo that contains many packages that can be used\ntogether or on their own,\nwith defaults to match GitHub or with configuration to match your site,\nto process user content for safe use on the web.\n\n## When should I use this?\n\nYou can use these tools when you need to:\n\n1. match GitHub in how it transforms markdown to HTML\n2. build similar pipelines to bring user content to the masses\n\n## Install\n\nCurrently,\ninstall and use each package manually.\n\n## Packages\n\n* [`remark-github-break`](packages/break/)\n  — turn normal line endings into hard breaks (**comments**)\n* [`remark-github-yaml-metadata`](packages/yaml-metadata/)\n  — show frontmatter as a table (**files**)\n* [`rehype-github-alert`](packages/alert/)\n  — enhance alerts (**everywhere**)\n* [`rehype-github-color`](packages/color/)\n  — enhance code for colors (**comments**)\n* [`rehype-github-dir`](packages/dir/)\n  — add `dir=auto` to elements (**everywhere**)\n* [`rehype-github-emoji`](packages/emoji/)\n  — enhance emoji and gemoji (**everywhere**)\n* [`rehype-github-heading`](packages/heading/)\n  — enhance headings (**files**)\n* `rehype-github-highlight`\n  — perform syntax highlighting on code (**to do**,\n  meanwhile use [`rehype-starry-night`][rehype-starry-night])\n* [`rehype-github-image`](packages/image/)\n  — enhance images (**everywhere**)\n* [`rehype-github-link`](packages/link/)\n  — enhance links (**everywhere**)\n* `rehype-github-mention`\n  — enhance mentions (**to do**)\n* [`rehype-github-notranslate`](packages/notranslate/)\n  — enhance raw text with `notranslate` (**comments**)\n* `rehype-github-reference`\n  — enhance references (**to do**)\n* `rehype-github-sanitize`\n  — clean dangerous HTML (**to do**,\n  meanwhile use [`rehype-sanitize`][rehype-sanitize])\n\nGitHub additionally includes client side code to enhance certain code blocks\nby evaluating their contents.\nThis behavior is performed by:\n\n* [`viewscreen-geojson`](packages/viewscreen-geojson/)\n  — viewscreen component for geojson and topojson\n* [`viewscreen-mermaid`](packages/viewscreen-mermaid/)\n  — viewscreen component for mermaid\n* [`viewscreen-stl`](packages/viewscreen-stl/)\n  — viewscreen component for STL (3D geometry)\n\nSee [`example/viewscreen/`](example/viewscreen/) on how to use them together.\n\nTo do:\n\n* investigate task lists\n* investigate mathjax\n* investigate port of treelights\n* investigate linking to labels,\n  issues,\n  pulls,\n  files,\n  lines in files\n\n## Examples\n\n### Example: comments\n\nA pipeline that gets close to how GitHub transforms comments:\n\n```js\nimport rehypeGithubAlert from 'rehype-github-alert'\nimport rehypeGithubColor from 'rehype-github-color'\nimport rehypeGithubDir from 'rehype-github-dir'\nimport rehypeGithubEmoji from 'rehype-github-emoji'\nimport rehypeGithubImage from 'rehype-github-image'\nimport rehypeGithubLink from 'rehype-github-link'\nimport rehypeGithubNoTranslate from 'rehype-github-notranslate'\nimport rehypeRaw from 'rehype-raw'\nimport rehypeSanitize from 'rehype-sanitize'\nimport rehypeStringify from 'rehype-stringify'\nimport remarkGithubBreak from 'remark-github-break'\nimport remarkParse from 'remark-parse'\nimport remarkRehype from 'remark-rehype'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkGithubBreak)\n  .use(remarkRehype, {allowDangerousHtml: true})\n  .use(rehypeRaw)\n  .use(rehypeGithubAlert)\n  .use(rehypeGithubColor)\n  .use(rehypeGithubDir)\n  .use(rehypeGithubEmoji)\n  .use(rehypeGithubImage)\n  .use(rehypeGithubLink)\n  .use(rehypeGithubNoTranslate)\n  .use(rehypeSanitize)\n  .use(rehypeStringify)\n  .process('hi!')\n\nconsole.log(String(file))\n```\n\nYields:\n\n```html\n\u003cp dir=\"auto\"\u003ehi!\u003c/p\u003e\n```\n\n### Example: files\n\nA pipeline that gets close to how GitHub transforms files:\n\n```js\nimport rehypeGithubAlert from 'rehype-github-alert'\nimport rehypeGithubDir from 'rehype-github-dir'\nimport rehypeGithubEmoji from 'rehype-github-emoji'\nimport rehypeGithubHeading from 'rehype-github-heading'\nimport rehypeGithubImage from 'rehype-github-image'\nimport rehypeGithubLink from 'rehype-github-link'\nimport rehypeRaw from 'rehype-raw'\nimport rehypeSanitize from 'rehype-sanitize'\nimport rehypeStringify from 'rehype-stringify'\nimport remarkGithubYamlMetadata from 'remark-github-yaml-metadata'\nimport remarkParse from 'remark-parse'\nimport remarkRehype from 'remark-rehype'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkGithubYamlMetadata)\n  .use(remarkRehype, {allowDangerousHtml: true})\n  .use(rehypeRaw)\n  .use(rehypeGithubAlert)\n  .use(rehypeGithubDir)\n  .use(rehypeGithubEmoji)\n  .use(rehypeGithubHeading)\n  .use(rehypeGithubImage)\n  .use(rehypeGithubLink)\n  .use(rehypeSanitize)\n  .use(rehypeStringify)\n  .process('hi!')\n\nconsole.log(String(file))\n```\n\nYields:\n\n```html\n\u003cp dir=\"auto\"\u003ehi!\u003c/p\u003e\n```\n\n## Types\n\nThese packages are fully typed with [TypeScript][].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with all maintained\nversions of Node.js.\nAs of now,\nthat is Node.js 16+.\nOur projects sometimes work with older versions,\nbut this is not guaranteed.\n\n## Security\n\nBe wary of user input and use [`rehype-sanitize`][rehype-sanitize].\n\n## Related\n\n* [`rehype-sanitize`][rehype-sanitize]\n  — sanitize HTML\n* [`rehype-starry-night`][rehype-starry-night]\n  — apply syntax highlighting to code with `starry-night`\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`rehypejs/.github`][health] for\nways to get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository,\norganization,\nor community you agree to abide by its terms.\n\n## Notice\n\nThis project is not affiliated with **GitHub**.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/rehypejs/rehype-github/workflows/main/badge.svg\n\n[build]: https://github.com/rehypejs/rehype-github/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype-github.svg\n\n[coverage]: https://codecov.io/github/rehypejs/rehype-github\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/rehypejs/rehype/discussions\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/rehypejs/.github\n\n[contributing]: https://github.com/rehypejs/.github/blob/main/contributing.md\n\n[support]: https://github.com/rehypejs/.github/blob/main/support.md\n\n[coc]: https://github.com/rehypejs/.github/blob/main/code-of-conduct.md\n\n[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize\n\n[rehype-starry-night]: https://github.com/rehypejs/rehype-starry-night\n\n[rehype]: https://github.com/rehypejs/rehype\n","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":["HTML"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frehypejs%2Frehype-github","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frehypejs%2Frehype-github","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frehypejs%2Frehype-github/lists"}