Skip to content

Commit 570a1c8

Browse files
IdrisGitghostdevv
authored andcommitted
feat: add copy readme to markdown button
1 parent bd4b408 commit 570a1c8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/pages/package/[[org]]/[name].vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,10 +1152,9 @@ onKeyStroke(
11521152
<button
11531153
type="button"
11541154
@click="copyReadme()"
1155-
class="px-2 py-1.5 font-mono text-xs rounded transition-colors duration-150 inline-flex items-center gap-1.5"
1156-
:class="
1157-
copiedReadme ? 'text-accent bg-accent/10' : 'text-fg-subtle bg-bg hover:text-fg'
1158-
"
1155+
v-if="readmeData?.md"
1156+
class="flex items-center h-8 gap-1.5 px-2 py-2 font-mono text-xs bg-bg-subtle border border-border-subtle border-solid rounded-md transition-colors duration-150 hover:(text-fg border-border-hover) active:scale-95 focus:border-border-hover hover:text-fg"
1157+
:class="copiedReadme ? 'text-fg' : 'text-fg-muted'"
11591158
:aria-label="
11601159
copiedReadme ? $t('common.copied') : $t('package.readme.copy_as_markdown')
11611160
"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default defineCachedEventHandler(
107107
}
108108

109109
if (!readmeContent || readmeContent === NPM_MISSING_README_SENTINEL) {
110-
return { html: '', playgroundLinks: [], toc: [] }
110+
return { html: '', markdown: '', playgroundLinks: [], toc: [] }
111111
}
112112

113113
// Parse repository info for resolving relative URLs to GitHub

0 commit comments

Comments
 (0)