@@ -26,7 +26,7 @@ interface FormattedFile {
2626
2727let block_open = false ;
2828
29- function code_renderer ( source : string , lang : string ) {
29+ function code_renderer ( source : string , lang : string ) : string {
3030 source = source . replace ( / ^ + / gm, ( match ) => match . split ( " " ) . join ( "\t" ) ) ;
3131
3232 const html = `<div class='code-block'>${ highlight (
@@ -42,7 +42,7 @@ function code_renderer(source: string, lang: string) {
4242 return html ;
4343}
4444
45- function hr_renderer ( ) {
45+ function hr_renderer ( ) : string {
4646 block_open = true ;
4747
4848 return '<div class="side-by-side"><div class="copy">' ;
@@ -52,10 +52,15 @@ let prev_level = 3;
5252let sections : section [ ] = [ ] ;
5353let section_stack = [ sections ] ;
5454
55- function heading_renderer ( text : string , level : number , rawtext : string ) {
55+ function heading_renderer (
56+ text : string ,
57+ level : number ,
58+ rawtext : string
59+ ) : string {
5660 let slug ;
5761
5862 const match = / < a h r e f = " ( [ ^ " ] + ) " [ ^ > ] * > ( .+ ) < \/ a > / . exec ( text ) ;
63+
5964 if ( match ) {
6065 slug = match [ 1 ] ;
6166 text = match [ 2 ] ;
@@ -92,12 +97,13 @@ function heading_renderer(text: string, level: number, rawtext: string) {
9297}
9398
9499const renderer = new marked . Renderer ( ) ;
100+
95101renderer . link = link_renderer ;
96102renderer . code = code_renderer ;
97103renderer . heading = heading_renderer ;
98104renderer . hr = hr_renderer ;
99105
100- export function transform_api ( file : string , markdown : string ) : FormattedFile {
106+ export function format_api ( file : string , markdown : string ) : FormattedFile {
101107 const { content, metadata } = extract_frontmatter ( markdown ) ;
102108 const section_slug = make_slug ( metadata . title ) ;
103109
0 commit comments