Feat:Add a copy README as markdown button on pages/package#1058
Feat:Add a copy README as markdown button on pages/package#1058carwack wants to merge 9 commits intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughReadmeResponse gained a new Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
i18n/locales/en.json (1)
213-226:⚠️ Potential issue | 🟡 MinorCapitalise “Markdown” in the label.
Minor copy consistency for a proper noun.✏️ Proposed copy tweak
- "copy_as_markdown": "Copy README as markdown" + "copy_as_markdown": "Copy README as Markdown"
🧹 Nitpick comments (2)
server/utils/readme.ts (1)
272-272: Consider making raw markdown lazy to avoid payload bloat.
Shipping both HTML and raw Markdown can nearly double response size for large READMEs. If this becomes a performance concern, consider fetchingmdon demand (or behind a flag) instead of always returning it.Also applies to: 456-459
app/pages/package/[...package].vue (1)
1139-1172: Clean implementation of the copy button UI.The button is correctly guarded by
v-if="readmeData?.md"and integrates well alongside the existing TOC dropdown. Accessibility attributes are properly applied.Two minor observations:
Redundant
disabledattribute (Line 1149): Since the parentTooltipAppalready hasv-if="readmeData?.md", the button only renders whenmdis truthy, making:disabled="!readmeData?.md"always evaluate tofalse. Consider removing it or keeping it for defensive coding if the structure might change.Overlapping CSS classes (Lines 1150-1153): The static
classincludestext-fg-subtle hover:text-fg, which duplicates the dynamic:classbinding for the non-copied state. This is harmless but could be tidied up.♻️ Optional: Remove redundant disabled and consolidate classes
<button type="button" `@click`="copyReadme()" - :disabled="!readmeData?.md" - class="px-2 py-1.5 font-mono text-xs rounded transition-colors duration-150 text-fg-subtle hover:text-fg inline-flex items-center gap-1.5" - :class=" - copiedReadme ? 'text-accent bg-accent/10' : 'text-fg-subtle bg-bg hover:text-fg' - " + class="px-2 py-1.5 font-mono text-xs rounded transition-colors duration-150 inline-flex items-center gap-1.5" + :class="copiedReadme ? 'text-accent bg-accent/10' : 'text-fg-subtle bg-bg hover:text-fg'" :aria-label=" copiedReadme ? $t('common.copied') : $t('package.readme.copy_as_markdown') "Based on learnings: The copy button pattern in this file is acceptable inline with the CSS-only approach for smooth animations; a reusable component may be introduced in the future.
ghostdevv
left a comment
There was a problem hiding this comment.
love it! I think your PR title needs casing correctly, I unfortunately don't have such powers
This should solve: #1020
I did implement it the way I understood it and took my inspiration from the Ark UI docs.
This PR adds a new copy README as markdown button for the README on a package page. This makes it possible to have the README content as markdown in the users clipboard.
Screen.Recording.2026-02-06.at.00.06.26.mov
I have also added the translations for the following languages: