66 * found in the LICENSE file at https://angular.dev/license 
77 */ 
88
9- import  { Renderer  as  MarkedRenderer }  from  'marked' ; 
9+ import  { Renderer  as  MarkedRenderer ,   Tokens }  from  'marked' ; 
1010import  { codeToHtml }  from  '../shiki/shiki' ; 
1111
1212/** 
1313 * Custom renderer for marked that will be used to transform markdown files to HTML 
1414 * files that can be used in the Angular docs. 
1515 */ 
1616export  const  renderer : Partial < MarkedRenderer >  =  { 
17-  code ( code :  string ,   language :  string ,   isEscaped :  boolean ) : string  { 
18-  const  highlightResult  =  codeToHtml ( code ,   language ) . replace ( / > \s + < / g,  '><' ) ; 
17+  code ( { lang ,  raw } ) : string  { 
18+  const  highlightResult  =  codeToHtml ( raw ,   lang ) . replace ( / > \s + < / g,  '><' ) ; 
1919
2020 return  ` 
2121 <div class="docs-code" role="group"> 
@@ -25,37 +25,46 @@ export const renderer: Partial<MarkedRenderer> = {
2525 </div> 
2626 ` ; 
2727 } , 
28-  image ( href :  string   |   null ,  title :  string   |   null ,  text :  string ) : string  { 
28+  image ( { href,  title,  text} ) : string  { 
2929 return  ` 
3030 <img src="${ href } ${ text } ${ title }  
3131 ` ; 
3232 } , 
33-  link ( href :  string ,   title :  string ,   text :  string ) : string  { 
33+  link ( { href,   text} ) : string  { 
3434 return  `<a href="${ href } ${ text }  ; 
3535 } , 
36-  list ( body :  string ,  ordered :  boolean ,  start :  number )  { 
36+  list ( { items ,  ordered,  start} )  { 
3737 if  ( ordered )  { 
3838 return  ` 
3939 <ol class="docs-ordered-list"> 
40-  ${ body }  
40+  ${ items }  
4141 </ol> 
4242 ` ; 
4343 } 
4444 return  ` 
4545 <ul class="docs-list"> 
46-  ${ body }  
46+  ${ items }  
4747 </ul> 
4848 ` ; 
4949 } , 
50-  table ( header : string ,  body : string ) : string  { 
50+ 
51+  table ( this : MarkedRenderer ,  { header,  rows} : Tokens . Table )  { 
5152 return  ` 
5253 <div class="docs-table docs-scroll-track-transparent"> 
5354 <table> 
5455 <thead> 
55-  ${ header }  
56+  ${ this . tablerow ( {  
57+  text : header . map ( ( cell )  =>  this . tablecell ( cell ) ) . join ( '' ) ,  
58+  } ) }  
5659 </thead> 
5760 <tbody> 
58-  ${ body }  
61+  ${ rows  
62+  . map ( ( row )  =>  
63+  this . tablerow ( {  
64+  text : row . map ( ( cell )  =>  this . tablecell ( cell ) ) . join ( '' ) ,  
65+  } ) ,  
66+  )  
67+  . join ( '' ) }  
5968 </tbody> 
6069 </table> 
6170 </div> 
0 commit comments