File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -307,3 +307,24 @@ describe('Markdown File URL Resolution', () => {
307307 } )
308308 } )
309309} )
310+
311+ describe ( 'Markdown Content Extraction' , ( ) => {
312+ describe ( 'Markdown' , ( ) => {
313+ it ( 'returns original markdown content unchanged' , async ( ) => {
314+ const markdown = `# Title\n\nSome **bold** text and a [link](https://example.com).`
315+ const result = await renderReadmeHtml ( markdown , 'test-pkg' )
316+
317+ expect ( result . md ) . toBe ( markdown )
318+ } )
319+ } )
320+ describe ( 'HTML' , ( ) => {
321+ it ( 'returns sanitized html' , async ( ) => {
322+ const markdown = `# Title\n\nSome **bold** text and a [link](https://example.com).`
323+ const result = await renderReadmeHtml ( markdown , 'test-pkg' )
324+
325+ expect ( result . html ) . toBe ( `<h3 id="user-content-title" data-level="1">Title</h3>
326+ <p>Some <strong>bold</strong> text and a <a href="https://example.com" rel="nofollow noreferrer noopener" target="_blank">link</a>.</p>
327+ ` )
328+ } )
329+ } )
330+ } )
You can’t perform that action at this time.
0 commit comments