-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#3264): ensure that remark files pass in file information
- Loading branch information
Nate Moore
committed
May 24, 2022
1 parent
81e07c7
commit 1d0c4c9
Showing
6 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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))); | ||
}); | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.