@@ -130,12 +130,15 @@ const renderSvg = ({
130130 description,
131131 section,
132132 command = "$ restish docs" ,
133- descMaxLines = 3 ,
133+ descMaxLines,
134134} ) => {
135- const titleLines = wrapText ( title , 710 , 68 , 3 ) ;
136- const descLines = wrapText ( description , 690 , 30 , descMaxLines ) ;
135+ const titleFontSize = title . length > 32 ? 58 : 68 ;
136+ const titleLineHeight = titleFontSize + 10 ;
137+ const titleLines = wrapText ( title , 610 , titleFontSize , 3 ) ;
138+ const resolvedDescMaxLines = descMaxLines ?? Math . max ( 3 , 6 - titleLines . length ) ;
139+ const descLines = wrapText ( description , 610 , 30 , resolvedDescMaxLines ) ;
137140 const titleY = 214 ;
138- const descY = titleY + titleLines . length * 78 + 30 ;
141+ const descY = titleY + titleLines . length * titleLineHeight + 30 ;
139142
140143 return `<?xml version="1.0" encoding="UTF-8"?>
141144<svg xmlns="http://www.w3.org/2000/svg" width="${ width } " height="${ height } " viewBox="0 0 ${ width } ${ height } ">
@@ -163,7 +166,7 @@ const renderSvg = ({
163166 ${ titleLines
164167 . map (
165168 ( line , index ) =>
166- `<text x="0" y="${ titleY + index * 78 } " fill="#f8fafc" font-family="Space Grotesk, Arial, Helvetica, sans-serif" font-size="68 " font-weight="700">${ escapeXml ( line ) } </text>` ,
169+ `<text x="0" y="${ titleY + index * titleLineHeight } " fill="#f8fafc" font-family="Space Grotesk, Arial, Helvetica, sans-serif" font-size="${ titleFontSize } " font-weight="700">${ escapeXml ( line ) } </text>` ,
167170 )
168171 . join ( "\n " ) }
169172 ${ descLines
@@ -205,7 +208,6 @@ const renderPng = async (socialPath, svg) => {
205208 const png = new Resvg ( svg , {
206209 fitTo : { mode : "width" , value : width } ,
207210 font : {
208- defaultFontFamily : "Space Grotesk" ,
209211 fontFiles : spaceGroteskFonts ,
210212 loadSystemFonts : true ,
211213 } ,
@@ -240,7 +242,7 @@ const renderGithubOverview = () =>
240242 "Explore REST-ish APIs with generic HTTP verbs, generated OpenAPI commands, shorthand input, auth, response filtering & projection, pagination, and plugins." ,
241243 section : "Always Free. Always Open Source." ,
242244 command : "$ brew install rest-sh/tap/restish" ,
243- descMaxLines : 4 ,
245+ descMaxLines : 5 ,
244246 } ) ,
245247 ) ;
246248
0 commit comments