{"id":51216879,"url":"https://github.com/tyeth/github-markdown-rendered-diff-bookmarklet","last_synced_at":"2026-06-28T04:31:25.670Z","repository":{"id":346670283,"uuid":"1191040793","full_name":"tyeth/github-markdown-rendered-diff-bookmarklet","owner":"tyeth","description":"A bookmarklet to augment the github diff pages with a rendered markdown viewer for any .md files that shows changed content in green/red banding like a diff viewer should!","archived":false,"fork":false,"pushed_at":"2026-03-25T03:37:40.000Z","size":971,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-26T04:02:03.431Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tyeth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-24T21:33:53.000Z","updated_at":"2026-03-25T03:37:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tyeth/github-markdown-rendered-diff-bookmarklet","commit_stats":null,"previous_names":["tyeth/github-markdown-rendered-diff-bookmarklet"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tyeth/github-markdown-rendered-diff-bookmarklet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyeth%2Fgithub-markdown-rendered-diff-bookmarklet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyeth%2Fgithub-markdown-rendered-diff-bookmarklet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyeth%2Fgithub-markdown-rendered-diff-bookmarklet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyeth%2Fgithub-markdown-rendered-diff-bookmarklet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tyeth","download_url":"https://codeload.github.com/tyeth/github-markdown-rendered-diff-bookmarklet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyeth%2Fgithub-markdown-rendered-diff-bookmarklet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34877471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"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":"2026-06-28T04:31:25.229Z","updated_at":"2026-06-28T04:31:25.655Z","avatar_url":"https://github.com/tyeth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Markdown Rendered Diff Bookmarklet\n\nA bookmarklet that adds a **\"Show Rendered Diff\"** button to GitHub diff pages, letting you toggle between the raw code diff and a rendered markdown view for `.md` files. Additions are highlighted in green, deletions in red, with word-level change highlighting.\n\n## Install\n\n1. Copy the entire contents of [`dist/bookmarklet.min.js`](dist/bookmarklet.min.js) (it starts with `javascript:`)\n2. Create a new bookmark in your browser\n3. Paste the copied code as the bookmark's **URL**\n4. Navigate to any GitHub diff page containing `.md` files and click the bookmark\n\n\u003e **Why a bookmarklet?** GitHub's Content Security Policy blocks external scripts and fetches to third-party CDNs. A bookmarklet runs as a `javascript:` URL in the page context, bypassing CSP restrictions. The markdown parser ([snarkdown](https://github.com/developit/snarkdown)) is bundled inline so no external requests are needed.\n\n**_Best used with the browsers Bookmark Bar/toolbar, if you don't mind losing the vertical space, usually found under the bookmarks menu_**\n\u003cimg width=\"907\" height=\"329\" alt=\"image\" src=\"https://github.com/user-attachments/assets/d0568f6a-58a2-4fbb-b105-58388f045425\" /\u003e\n\n\n## Features\n\n- **Rendered markdown diff** — headings, bold, italic, links, images, lists, blockquotes, code blocks, inline code, horizontal rules\n- **Pipe tables** — converted to styled HTML tables, with support for escaped pipes inside backtick code, HTML formatting in cells, and separate tables from blank-line-separated blocks\n- **Unified and split view** — detects GitHub's diff layout and renders accordingly; split view aligns context sections horizontally between old/new panes\n- **Dark mode** — respects GitHub's `data-color-mode` theme setting\n- **Word-level highlighting** — changed words within a line are highlighted more strongly using LCS-based diffing\n- **Code block styling** — fenced code blocks and inline code get a subtle background, matching GitHub's style\n- **Dual GitHub UI support** — works on both the classic (logged-out) UI and the React-based (logged-in) UI\n- **Works across page types** — PR file changes, branch/tag compare pages, and commit diffs\n- **Toggle button** — \"Show Rendered Diff\" / \"Show Code Diff\" button added to each `.md` file header\n- **Idempotent** — running the bookmarklet multiple times won't duplicate buttons or views\n- **~14 KB** — snarkdown bundled inline, minified with terser\n\n## Supported Page Types\n\n| Page type | Logged in | Logged out |\n|-----------|-----------|------------|\n| PR changes (`/pull/N/files`) | Unified + Split | N/A |\n| Compare (`/compare/A...B`) | Unified + Split | Unified + Split |\n| Commit diff (`/commit/SHA`) | Unified + Split | Unified + Split |\n\n## Limitations\n\n- **snarkdown is minimal** — it does not support nested lists, task checkboxes, footnotes, or definition lists. These will render as plain text or malformed HTML.\n- **Images are not loaded** — `![alt](url)` renders as `\u003cimg\u003e` tags but GitHub's CSP blocks most external image sources in the diff context.\n- **Large diffs** — very large files may be slow to parse and render, since all processing happens client-side in a single pass.\n- **Collapsed file diffs** — if GitHub collapses a large diff (\"Load diff\" button), the bookmarklet can only process what is visible in the DOM. Expand the diff first, then run the bookmarklet again.\n- **GitHub UI changes** — this bookmarklet relies on specific CSS classes and DOM structure. GitHub updates may break detection; the dual-UI approach (classic + React selectors) mitigates this.\n\n## Development\n\n```bash\nnpm install\nnpm run build        # builds dist/bookmarklet.min.js\nnpm test             # runs Playwright tests (30 tests across 4 page types)\nnpm run test:headed  # runs tests with visible browser\n```\n\nThe build script (`scripts/build-bookmarklet.js`) concatenates snarkdown with `src/bookmarklet.js`, minifies with terser, and prepends `javascript:`.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyeth%2Fgithub-markdown-rendered-diff-bookmarklet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyeth%2Fgithub-markdown-rendered-diff-bookmarklet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyeth%2Fgithub-markdown-rendered-diff-bookmarklet/lists"}