@@ -21,10 +21,11 @@ function createClassSymbol(classDef: DenoDocNode['classDef']): MergedSymbol {
2121 }
2222}
2323
24- function createFunctionSymbol ( name : string ) : MergedSymbol {
24+ function createFunctionSymbol ( name : string , jsDoc ?: DenoDocNode [ 'jsDoc' ] ) : MergedSymbol {
2525 const node : DenoDocNode = {
2626 name,
2727 kind : 'function' ,
28+ jsDoc,
2829 functionDef : {
2930 params : [ ] ,
3031 returnType : { repr : 'void' , kind : 'keyword' , keyword : 'void' } ,
@@ -34,6 +35,7 @@ function createFunctionSymbol(name: string): MergedSymbol {
3435 return {
3536 name,
3637 kind : 'function' ,
38+ jsDoc,
3739 nodes : [ node ] ,
3840 }
3941}
@@ -192,3 +194,25 @@ describe('renderDocNodes ordering', () => {
192194 expect ( alphaIndex ) . toBeLessThan ( betaIndex )
193195 } )
194196} )
197+
198+ describe ( 'renderDocNodes examples' , ( ) => {
199+ it ( 'handles hyphenated fenced code languages in @example tags' , async ( ) => {
200+ const symbol = createFunctionSymbol ( 'renderTemplate' , {
201+ tags : [
202+ {
203+ kind : 'example' ,
204+ doc : '```glimmer-ts\nconst greeting = <template>Hello</template>\n```' ,
205+ } ,
206+ ] ,
207+ } )
208+
209+ const html = await renderDocNodes ( [ symbol ] , new Map ( ) )
210+
211+ expect ( html ) . toContain ( '<h4>Example</h4>' )
212+ expect ( html ) . toContain ( 'shiki' )
213+ expect ( html ) . toContain ( 'greeting' )
214+ expect ( html ) . not . toMatch ( / ( ^ | [ > \s ] ) - t s ( [ < \s ] | $ ) / )
215+ expect ( html ) . not . toContain ( '-ts' )
216+ expect ( html ) . not . toContain ( '```' )
217+ } )
218+ } )
0 commit comments