mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
cfae9760b2
* feat: use internal MDX tooling for markdown + components * fix: improve MD + component tests * chore: add changeset * fix: make tsc happy * fix(#3319): add regression test for component children * fix(markdown): support HTML comments in markdown * fix(#2474): ensure namespaced components are properly handled in markdown pages * fix(#3220): ensure html in markdown pages does not have extra surrounding space * fix(#3264): ensure that remark files pass in file information * fix(#3254): enable experimentalStaticExtraction for `.md` pages * fix: revert parsing change * fix: remove `markdown.mode` option
26 lines
679 B
JavaScript
26 lines
679 B
JavaScript
import { renderMarkdown } from '../dist/index.js';
|
|
import chai from 'chai';
|
|
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
describe('plugins', () => {
|
|
// https://github.com/withastro/astro/issues/3264
|
|
it('should be able to get file path when passing fileURL', async () => {
|
|
let context;
|
|
await renderMarkdown(`test`, {
|
|
fileURL: new URL('virtual.md', import.meta.url),
|
|
remarkPlugins: [
|
|
function () {
|
|
const transformer = (tree, file) => {
|
|
context = file;
|
|
};
|
|
|
|
return transformer;
|
|
}
|
|
]
|
|
});
|
|
|
|
chai.expect(typeof context).to.equal('object');
|
|
chai.expect(context.path).to.equal(fileURLToPath(new URL('virtual.md', import.meta.url)));
|
|
});
|
|
})
|