From 53f5c19b60342ce770ff71f901a3540ab4f66b38 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 08:13:04 +0000 Subject: [PATCH 1/2] Initial plan From d8cef8b0edbf7b52517d47f6f6a58f4262dd1f7b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 08:17:10 +0000 Subject: [PATCH 2/2] Add isRenderedTextFile and hasRenderedText functions Implements detection for rendered text files including markdown, textile, rdoc, org, creole, mediawiki, wiki, rst, asciidoc, and pod files. The hasRenderedText function combines isRepoRoot with isRenderedTextFile to identify pages that display rendered text content. Co-authored-by: fregante <1402241+fregante@users.noreply.github.com> --- index.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 8f9156c3..c220a87c 100644 --- a/index.ts +++ b/index.ts @@ -594,7 +594,30 @@ TEST: addTests('isSingleFile', [ 'https://github.com/sindresorhus/refined-github/blob/master/.gitattributes', 'https://github.com/sindresorhus/refined-github/blob/fix-narrow-diff/distribution/content.css', 'https://github.com/sindresorhus/refined-github/blob/master/edit.txt', -]); + 'isRenderedTextFile', +]); + +export const isRenderedTextFile = (url: URL | HTMLAnchorElement | Location = location): boolean => isSingleFile(url) && /\.(md|markdown|mdown|mkdn|textile|rdoc|org|creole|mediawiki|wiki|rst|asciidoc|adoc|asc|pod)$/i.test(url.pathname); +TEST: addTests('isRenderedTextFile', [ + 'https://github.com/sindresorhus/refined-github/blob/master/readme.md', + 'https://github.com/sindresorhus/refined-github/blob/master/README.markdown', + 'https://github.com/sindresorhus/refined-github/blob/main/docs/guide.mdown', + 'https://github.com/sindresorhus/refined-github/blob/main/CONTRIBUTING.mkdn', + 'https://github.com/sindresorhus/refined-github/blob/master/file.textile', + 'https://github.com/sindresorhus/refined-github/blob/master/file.rdoc', + 'https://github.com/sindresorhus/refined-github/blob/master/file.org', + 'https://github.com/sindresorhus/refined-github/blob/master/file.creole', + 'https://github.com/sindresorhus/refined-github/blob/master/file.mediawiki', + 'https://github.com/sindresorhus/refined-github/blob/master/file.wiki', + 'https://github.com/sindresorhus/refined-github/blob/master/file.rst', + 'https://github.com/sindresorhus/refined-github/blob/master/file.asciidoc', + 'https://github.com/sindresorhus/refined-github/blob/master/file.adoc', + 'https://github.com/sindresorhus/refined-github/blob/master/file.asc', + 'https://github.com/sindresorhus/refined-github/blob/master/file.pod', +]); + +export const hasRenderedText = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepoRoot(url) || isRenderedTextFile(url); +TEST: addTests('hasRenderedText', combinedTestOnly); export const isFileFinder = (url: URL | HTMLAnchorElement | Location = location): boolean => Boolean(getRepo(url)?.path.startsWith('find/')); TEST: addTests('isFileFinder', [