@@ -909,6 +909,60 @@ async function renderListItemBody(
909909 return body || " " ;
910910}
911911
912+ function renderDataTable ( node : JSONContent , options : DcExportOptions ) : string {
913+ const palette = documentPalette ( options ) ;
914+ const isDarkEditorial = normalizeDocumentTheme ( options . documentTheme ) === "darkEditorial" ;
915+ const tableBorder = isDarkEditorial ? "#3a3a3a" : "#d8d2c4" ;
916+ const headerBackground = isDarkEditorial ? "#242424" : "#f3eadb" ;
917+ const cellBackground = isDarkEditorial ? dcDarkPageBackground : dcLightPageBackground ;
918+ const tableStyle = joinStyle ( {
919+ width : "100%" ,
920+ margin : "0 0 16px" ,
921+ "border-collapse" : "collapse" ,
922+ "table-layout" : "fixed" ,
923+ color : palette . text ,
924+ "font-family" : safeProseFontFamily ( options . bodyFontFamily ) ,
925+ "font-size" : safeBodyFontSize ( options ) ,
926+ "line-height" : 1.62 ,
927+ } ) ;
928+ const rows = childrenOf ( node )
929+ . map ( ( row ) => {
930+ const cells = childrenOf ( row )
931+ . map ( ( cell ) => {
932+ const isHeader = cell . attrs ?. header === true ;
933+ const tag = isHeader ? "th" : "td" ;
934+ const cellStyle = joinStyle ( {
935+ padding : isHeader ? "8px 10px" : "9px 10px" ,
936+ border : `1px solid ${ tableBorder } ` ,
937+ "background-color" : isHeader ? headerBackground : cellBackground ,
938+ color : isHeader ? palette . heading : undefined ,
939+ "font-weight" : isHeader ? 700 : undefined ,
940+ "text-align" : "left" ,
941+ "vertical-align" : "top" ,
942+ "word-break" : "keep-all" ,
943+ "overflow-wrap" : "break-word" ,
944+ } ) ;
945+ const body = renderInlineChildren ( cell , options , {
946+ text : isHeader ? palette . heading : palette . text ,
947+ background : isHeader ? headerBackground : cellBackground ,
948+ inlineCodeBackground : palette . inlineCodeBackground ,
949+ inlineCodeText : palette . inlineCodeText ,
950+ } ) ;
951+
952+ return `<${ tag } style="${ cellStyle } ">${ body || " " } </${ tag } >` ;
953+ } )
954+ . join ( "" ) ;
955+
956+ return cells ? `<tr>${ cells } </tr>` : "" ;
957+ } )
958+ . filter ( Boolean )
959+ . join ( "" ) ;
960+
961+ return rows
962+ ? `<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="${ palette . fallbackBackground } " style="${ tableStyle } "><tbody>${ rows } </tbody></table>`
963+ : "" ;
964+ }
965+
912966async function renderCallout (
913967 node : JSONContent ,
914968 options : DcExportOptions ,
@@ -2207,12 +2261,12 @@ function comparisonBlockPalette(options: DcExportOptions) {
22072261 } ;
22082262}
22092263
2210- function tutorialStepTitle ( node : JSONContent , index : number ) : string {
2264+ function tutorialStepTitle ( node : JSONContent ) : string {
22112265 if ( typeof node . attrs ?. title === "string" && node . attrs . title . trim ( ) ) {
22122266 return node . attrs . title . trim ( ) ;
22132267 }
22142268
2215- return `단계 ${ index + 1 } ` ;
2269+ return "" ;
22162270}
22172271
22182272function tutorialStepNumber ( node : JSONContent , index : number ) : string {
@@ -2304,16 +2358,17 @@ async function renderTutorialBlockModern(
23042358 const cards = await Promise . all (
23052359 steps . map ( async ( step , index ) => {
23062360 const number = tutorialStepNumber ( step , index ) ;
2307- const title = escapeHtml ( tutorialStepTitle ( step , index ) ) ;
2361+ const title = escapeHtml ( tutorialStepTitle ( step ) ) ;
23082362 const body = await renderTutorialStepBody (
23092363 step ,
23102364 options ,
23112365 palette . text ,
23122366 palette . cardBackground ,
23132367 ) ;
23142368 const bodyHtml = body ? `<div style="${ bodyStyle } ">${ body } </div>` : "" ;
2369+ const titleHtml = title ? `<strong style="${ titleStyle } ">${ title } </strong>` : "" ;
23152370
2316- return `<section style="${ cardStyle } "><div style="${ headStyle } "><span style="${ numberCellStyle } "><span style="${ numberStyle } ">${ number } </span></span><strong style=" ${ titleStyle } "> ${ title } </strong> </div>${ bodyHtml } </section>` ;
2371+ return `<section style="${ cardStyle } "><div style="${ headStyle } "><span style="${ numberCellStyle } "><span style="${ numberStyle } ">${ number } </span></span>${ titleHtml } </div>${ bodyHtml } </section>` ;
23172372 } ) ,
23182373 ) ;
23192374
@@ -2369,7 +2424,7 @@ async function renderTutorialBlockTable(
23692424 const cards = await Promise . all (
23702425 steps . map ( async ( step , index ) => {
23712426 const number = tutorialStepNumber ( step , index ) ;
2372- const title = escapeHtml ( tutorialStepTitle ( step , index ) ) ;
2427+ const title = escapeHtml ( tutorialStepTitle ( step ) ) ;
23732428 const body = await renderTutorialStepBody (
23742429 step ,
23752430 options ,
@@ -2388,8 +2443,9 @@ async function renderTutorialBlockTable(
23882443 const bodyRow = body
23892444 ? `<tr><td style="${ bodySpacerCellStyle } "> </td><td style="${ bodyCellStyle } ">${ body } </td></tr>`
23902445 : "" ;
2446+ const titleHtml = title ? `<strong style="${ titleStyle } ">${ title } </strong>` : " " ;
23912447
2392- return `<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="${ palette . cardFallbackBackground } " style="${ cardTableStyle } "><tbody><tr><td style="${ numberCellStyle } ">${ badge } </td><td style="${ headCellStyle } "><strong style=" ${ titleStyle } "> ${ title } </strong> </td></tr>${ bodyRow } </tbody></table>` ;
2448+ return `<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="${ palette . cardFallbackBackground } " style="${ cardTableStyle } "><tbody><tr><td style="${ numberCellStyle } ">${ badge } </td><td style="${ headCellStyle } ">${ titleHtml } </td></tr>${ bodyRow } </tbody></table>` ;
23932449 } ) ,
23942450 ) ;
23952451
@@ -2617,6 +2673,8 @@ async function renderBlockAsync(
26172673 return renderTutorialBlock ( node , options ) ;
26182674 case "comparisonBlock" :
26192675 return renderComparisonBlock ( node , options ) ;
2676+ case "dcDataTable" :
2677+ return renderDataTable ( node , options ) ;
26202678 case "codeBlock" :
26212679 return renderCodeBlock ( node , options ) ;
26222680 case "blockquote" :
0 commit comments