@@ -596,7 +596,30 @@ TEST: addTests('isSingleFile', [
596596 'https://github.com/sindresorhus/refined-github/blob/master/.gitattributes' ,
597597 'https://github.com/sindresorhus/refined-github/blob/fix-narrow-diff/distribution/content.css' ,
598598 'https://github.com/sindresorhus/refined-github/blob/master/edit.txt' ,
599- ] ) ;
599+ 'isRenderedTextFile' ,
600+ ] ) ;
601+
602+ export const isRenderedTextFile = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => isSingleFile ( url ) && / \. ( m d | m a r k d o w n | m d o w n | m k d n | t e x t i l e | r d o c | o r g | c r e o l e | m e d i a w i k i | w i k i | r s t | a s c i i d o c | a d o c | a s c | p o d ) $ / i. test ( url . pathname ) ;
603+ TEST: addTests ( 'isRenderedTextFile' , [
604+ 'https://github.com/sindresorhus/refined-github/blob/master/readme.md' ,
605+ 'https://github.com/sindresorhus/refined-github/blob/master/README.markdown' ,
606+ 'https://github.com/sindresorhus/refined-github/blob/main/docs/guide.mdown' ,
607+ 'https://github.com/sindresorhus/refined-github/blob/main/CONTRIBUTING.mkdn' ,
608+ 'https://github.com/sindresorhus/refined-github/blob/master/file.textile' ,
609+ 'https://github.com/sindresorhus/refined-github/blob/master/file.rdoc' ,
610+ 'https://github.com/sindresorhus/refined-github/blob/master/file.org' ,
611+ 'https://github.com/sindresorhus/refined-github/blob/master/file.creole' ,
612+ 'https://github.com/sindresorhus/refined-github/blob/master/file.mediawiki' ,
613+ 'https://github.com/sindresorhus/refined-github/blob/master/file.wiki' ,
614+ 'https://github.com/sindresorhus/refined-github/blob/master/file.rst' ,
615+ 'https://github.com/sindresorhus/refined-github/blob/master/file.asciidoc' ,
616+ 'https://github.com/sindresorhus/refined-github/blob/master/file.adoc' ,
617+ 'https://github.com/sindresorhus/refined-github/blob/master/file.asc' ,
618+ 'https://github.com/sindresorhus/refined-github/blob/master/file.pod' ,
619+ ] ) ;
620+
621+ export const hasRenderedText = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => isRepoRoot ( url ) || isRenderedTextFile ( url ) ;
622+ TEST: addTests ( 'hasRenderedText' , combinedTestOnly ) ;
600623
601624export const isFileFinder = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => Boolean ( getRepo ( url ) ?. path . startsWith ( 'find/' ) ) ;
602625TEST: addTests ( 'isFileFinder' , [
0 commit comments