fix(build): remove frontmatter in md file inclusion

closes #3195
pull/3200/head
Divyansh Singh 2 years ago
parent a482611d17
commit dbbffa2487

@ -274,4 +274,9 @@ describe('Markdown File Inclusion', () => {
expect(trim(await p.nth(0).textContent())).toBe('This is a region')
expect(trim(await p.nth(1).textContent())).toBe('This is after region')
})
test('ignore frontmatter if range is not specified', async () => {
const p = page.locator('.vp-doc')
expect(await p.textContent()).not.toContain('title')
})
})

@ -1,3 +1,7 @@
---
title: Nested Include
---
<!--@include: ./foo.md-->
### After Foo

@ -1,5 +1,6 @@
import path from 'path'
import fs from 'fs-extra'
import matter from 'gray-matter'
import path from 'path'
import { slash } from '../shared'
export function processIncludes(
@ -30,6 +31,8 @@ export function processIncludes(
endLine ? parseInt(endLine, 10) : undefined
)
.join('\n')
} else {
content = matter(content).content
}
includes.push(slash(includePath))
// recursively process includes in the content

Loading…
Cancel
Save