From bba538336a7628c4da9d3012f8420da033e65488 Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Sat, 29 Nov 2025 23:08:00 +1000 Subject: [PATCH] feat: improve README markdown styling to match npm.com quality MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Enhanced Markdown Rendering:** - Use prose-slate for better default typography - Add proper heading hierarchy with bottom borders on h1/h2 - Improve code block styling with better backgrounds and shadows - Style inline code with pink/red accent colors like npm - Better table styling with proper borders and rounded corners - Improve link colors (blue) with hover effects - Add better spacing throughout (margins, padding, line-height) - Enhance blockquote styling with background colors - Better list spacing with space-y-2 - Add proper light/dark mode support with zinc color palette **Component Updates:** - Custom pre component with better background and border - Custom table wrapper with overflow handling - Improved link component with external link detection - Better inline code styling The README now renders beautifully like npm.com instead of looking plain. šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- apps/web/src/components/Markdown.tsx | 81 +++++++++++++++++++--------- packages/db/sync-single-tool.mjs | 35 ++++++++++++ 2 files changed, 90 insertions(+), 26 deletions(-) create mode 100644 packages/db/sync-single-tool.mjs diff --git a/apps/web/src/components/Markdown.tsx b/apps/web/src/components/Markdown.tsx index 8f6f1e0..8caef0a 100644 --- a/apps/web/src/components/Markdown.tsx +++ b/apps/web/src/components/Markdown.tsx @@ -13,44 +13,49 @@ interface MarkdownProps { /** * Markdown renderer component * Safely renders markdown content with GitHub Flavored Markdown support + * Styled to match npm.com's beautiful README rendering */ export function Markdown({ content, className = '' }: MarkdownProps): React.ReactElement { return (
{ const isInline = !className; if (isInline) { return ( - + {children} ); @@ -61,7 +66,18 @@ export function Markdown({ content, className = '' }: MarkdownProps): React.Reac ); }, - // Make links open in new tab + // Better styled pre blocks + pre: ({ children, ...props }) => { + return ( +
+                {children}
+              
+ ); + }, + // Make links open in new tab with better styling a: ({ href, children, ...props }) => { const isExternal = href?.startsWith('http'); return ( @@ -69,13 +85,26 @@ export function Markdown({ content, className = '' }: MarkdownProps): React.Reac href={href} target={isExternal ? '_blank' : undefined} rel={isExternal ? 'noopener noreferrer' : undefined} - className="text-primary hover:underline" + className="text-blue-600 dark:text-blue-400 hover:underline font-medium" {...props} > {children} ); }, + // Better table styling + table: ({ children, ...props }) => { + return ( +
+ + {children} +
+
+ ); + }, }} > {content} diff --git a/packages/db/sync-single-tool.mjs b/packages/db/sync-single-tool.mjs new file mode 100644 index 0000000..e7decfc --- /dev/null +++ b/packages/db/sync-single-tool.mjs @@ -0,0 +1,35 @@ +import { PrismaClient } from '@prisma/client'; +import { fetchLatestPackageWithMetadata } from '@tpmjs/npm-client'; + +const prisma = new PrismaClient(); + +async function main() { + const packageName = '@tpmjs/text-transformer'; + + console.log(`Fetching metadata for ${packageName}...`); + const pkg = await fetchLatestPackageWithMetadata(packageName); + + if (!pkg) { + console.error('Package not found!'); + return; + } + + console.log(`Found ${packageName} v${pkg.version}`); + console.log(`README length: ${pkg.readme ? pkg.readme.length : 0} chars`); + console.log(`Keywords: ${(pkg.topLevelKeywords || pkg.keywords || []).join(', ')}`); + + // Update the tool in the database + await prisma.tool.update({ + where: { npmPackageName: packageName }, + data: { + npmReadme: pkg.readme || null, + npmKeywords: pkg.topLevelKeywords || pkg.keywords || [], + npmAuthor: pkg.author || null, + npmMaintainers: pkg.maintainers || null, + } + }); + + console.log('\nāœ… Tool updated successfully!'); +} + +main().finally(() => prisma.$disconnect());