Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

Adds detection for pages displaying rendered markup content (markdown, textile, rdoc, org, creole, mediawiki, wiki, rst, asciidoc, pod) as specified in GitHub's markup gem.

Changes

  • isRenderedTextFile(url): Detects single file pages with rendered text extensions

    • Matches against: .md, .markdown, .mdown, .mkdn, .textile, .rdoc, .org, .creole, .mediawiki, .wiki, .rst, .asciidoc, .adoc, .asc, .pod
    • Case-insensitive extension matching
  • hasRenderedText(url): Composite detection for pages with rendered text

    • Returns true for repository root (README display) or rendered text files
    • Intentionally excludes SVG and other rendered content

Usage

import { isRenderedTextFile, hasRenderedText } from 'github-url-detection';

// Detect rendered text file
isRenderedTextFile(new URL('https://github.com/user/repo/blob/main/README.md')) // true
isRenderedTextFile(new URL('https://github.com/user/repo/blob/main/file.svg')) // false

// Detect any page with rendered text
hasRenderedText(new URL('https://github.com/user/repo')) // true (repo root)
hasRenderedText(new URL('https://github.com/user/repo/blob/main/docs.rst')) // true
Original prompt

This section details on the original issue you should resolve

<issue_title>hasRenderedText (markdown etc)</issue_title>
<issue_description>```js
export const isRenderedTextFile = isSingleFile && endsWith(md)
export const hasRenderedText = isRepoRoot || isRenderedTextFile || etc


These shouldn't include SVG and other rendered content

Partially implemented in https://github.com/refined-github/refined-github/pull/4151/files#diff-a1b04b00ad1bdc63f8898dfbf43b2faf61ae3be4f50182d5a144d3e7f0dc7c29R14</issue_description>

<agent_instructions>The test is effectively /\.(textile|rdoc|org|creole|(media)?wiki|rst|a(scii)?doc|asc|pod)$/.test(location.pathname) but include markdown extensions.

origin: https://github.com/github/markup/blob/2b0e7f216904253092c90754cd95aac6d499583d/README.md</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

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>
Copilot AI changed the title [WIP] Fix hasRenderedText logic to exclude SVG and other content Add isRenderedTextFile and hasRenderedText detection functions Jan 14, 2026
Copilot AI requested a review from fregante January 14, 2026 08:19
@fregante fregante marked this pull request as ready for review January 14, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

hasRenderedText (markdown etc)

2 participants