@@ -107,6 +107,16 @@ describe('JsdocCodeExampleHelper', () => {
107107 expect ( result [ 0 ] . language ) . to . equal ( 'typescript' ) ;
108108 expect ( result [ 0 ] . code ) . to . equal ( 'const test = "hello";' ) ;
109109 } ) ;
110+
111+ it ( 'should parse indented code fences correctly' , ( ) => {
112+ const comment = ' ```html\n<y-map>\n <y-map-default-scheme-layer />\n</y-map>\n ```' ;
113+ const result = helper [ 'parseCodeFences' ] ( comment ) ;
114+
115+ expect ( result ) . to . have . length ( 1 ) ;
116+ expect ( result [ 0 ] . language ) . to . equal ( 'html' ) ;
117+ expect ( result [ 0 ] . code ) . to . contain ( '<y-map>' ) ;
118+ expect ( result [ 0 ] . code ) . to . contain ( '</y-map>' ) ;
119+ } ) ;
110120 } ) ;
111121
112122 describe ( 'cleanTag method' , ( ) => {
@@ -261,5 +271,21 @@ describe('JsdocCodeExampleHelper', () => {
261271 expect ( mockContext . tags [ 0 ] . comment ) . to . contain ( '<code class="language-typescript">' ) ;
262272 expect ( mockContext . tags [ 0 ] . comment ) . to . contain ( '</code></pre>' ) ;
263273 } ) ;
274+
275+ it ( 'should process @example tags with indented fenced html blocks' , ( ) => {
276+ const jsdocTags : JsdocTagInterface [ ] = [
277+ createMockJsdocTag (
278+ 'example' ,
279+ ' ```html\n<y-map>\n <y-map-default-scheme-layer />\n <y-map-default-features-layer />\n</y-map>\n ```'
280+ )
281+ ] ;
282+
283+ helper . helperFunc ( mockContext , jsdocTags , mockOptions ) ;
284+
285+ expect ( mockContext . tags ) . to . have . length ( 1 ) ;
286+ expect ( mockContext . tags [ 0 ] . comment ) . to . contain ( 'language-html' ) ;
287+ expect ( mockContext . tags [ 0 ] . comment ) . to . contain ( '<y-map>' ) ;
288+ expect ( mockContext . tags [ 0 ] . comment ) . to . not . contain ( '```html' ) ;
289+ } ) ;
264290 } ) ;
265291} ) ;
0 commit comments