This commit is contained in:
@@ -70,4 +70,31 @@ describe('renderMarkdown', () => {
|
||||
expect(html).not.toContain('<table')
|
||||
expect(html).toContain('<p>a | b not a table</p>')
|
||||
})
|
||||
it('resolves a relative image against the document folder', () => {
|
||||
const html = renderMarkdown('', 'docs/how-to')
|
||||
expect(html).toContain('data-src="docs/how-to/forge-app-config.png"')
|
||||
expect(html).not.toContain(' src=')
|
||||
})
|
||||
|
||||
it('keeps the image title out of the path and walks up a parent folder', () => {
|
||||
const html = renderMarkdown('', 'docs/how-to')
|
||||
expect(html).toContain('data-src="docs/img/a b.png"')
|
||||
expect(html).toContain('title="A title"')
|
||||
})
|
||||
|
||||
it('reads a leading slash as the project root', () => {
|
||||
expect(renderMarkdown('', 'docs/how-to')).toContain('data-src="img/a.png"')
|
||||
})
|
||||
|
||||
it('leaves a remote image on src', () => {
|
||||
const html = renderMarkdown('', 'docs')
|
||||
expect(html).toContain('src="https://x.com/a.png"')
|
||||
expect(html).not.toContain('data-src')
|
||||
})
|
||||
|
||||
it('keeps a link title out of the href', () => {
|
||||
const html = renderMarkdown('[a](https://x.com "Home")')
|
||||
expect(html).toContain('href="https://x.com"')
|
||||
expect(html).toContain('title="Home"')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user