Skip to content

Commit d99b590

Browse files
authored
feat: add support for markdown extension in readme files (#123)
1 parent cda7f6e commit d99b590

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

app/utils/file-icons.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ const FILENAME_ICONS: Record<string, string> = {
249249
'README': 'i-vscode-icons-file-type-markdown',
250250
'README.md': 'i-vscode-icons-file-type-markdown',
251251
'readme.md': 'i-vscode-icons-file-type-markdown',
252-
'Readme.md': 'i-vscode-icons-file-type-markdown',
252+
'README.markdown': 'i-vscode-icons-file-type-markdown',
253+
'readme.markdown': 'i-vscode-icons-file-type-markdown',
253254
'CHANGELOG': 'i-vscode-icons-file-type-markdown',
254255
'CHANGELOG.md': 'i-vscode-icons-file-type-markdown',
255256
'changelog.md': 'i-vscode-icons-file-type-markdown',

server/api/registry/readme/[...pkg].get.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ async function fetchReadmeFromJsdelivr(
1414
packageName: string,
1515
version?: string,
1616
): Promise<string | null> {
17-
const filenames = ['README.md', 'readme.md', 'Readme.md', 'README', 'readme']
17+
const filenames = [
18+
'README.md',
19+
'readme.md',
20+
'Readme.md',
21+
'README',
22+
'readme',
23+
'README.markdown',
24+
'readme.markdown',
25+
]
1826
const versionSuffix = version ? `@${version}` : ''
1927

2028
for (const filename of filenames) {

server/utils/code-highlight.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const FILENAME_MAP: Record<string, string> = {
7474
'CHANGELOG.md': 'markdown',
7575
'README': 'markdown',
7676
'README.md': 'markdown',
77+
'README.markdown': 'markdown',
7778
}
7879

7980
/**

0 commit comments

Comments
 (0)