@@ -318,4 +318,36 @@ describe('useMarkdown', () => {
318318 expect ( processed . value ) . toBe ( 'bold and <strong>also bold</strong>' )
319319 } )
320320 } )
321+
322+ describe ( 'HTML comment stripping' , ( ) => {
323+ it ( 'strips HTML comments' , ( ) => {
324+ const processed = useMarkdown ( { text : '<!-- automd:badges color=yellow -->A library' } )
325+ expect ( processed . value ) . toBe ( 'A library' )
326+ } )
327+
328+ it ( 'strips HTML comments from the middle of text' , ( ) => {
329+ const processed = useMarkdown ( { text : 'Before <!-- comment --> after' } )
330+ expect ( processed . value ) . toBe ( 'Before after' )
331+ } )
332+
333+ it ( 'strips multiple HTML comments' , ( ) => {
334+ const processed = useMarkdown ( { text : '<!-- first -->Text <!-- second -->here' } )
335+ expect ( processed . value ) . toBe ( 'Text here' )
336+ } )
337+
338+ it ( 'strips multiline HTML comments' , ( ) => {
339+ const processed = useMarkdown ( { text : '<!-- multi\nline\ncomment -->Text' } )
340+ expect ( processed . value ) . toBe ( 'Text' )
341+ } )
342+
343+ it ( 'returns empty string when description is only a comment' , ( ) => {
344+ const processed = useMarkdown ( { text : '<!-- automd:badges color=yellow -->' } )
345+ expect ( processed . value ) . toBe ( '' )
346+ } )
347+
348+ it ( 'strips unclosed HTML comments (truncated)' , ( ) => {
349+ const processed = useMarkdown ( { text : 'A library <!-- automd:badges color=yel' } )
350+ expect ( processed . value ) . toBe ( 'A library ' )
351+ } )
352+ } )
321353} )
0 commit comments