-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need an example #3
Comments
Prettier options are resolved based on the file path. So you need to pass that too. Your code should become something like this: const compiler = unified()
.use(remarkParse)
.use(gfm)
.use(remarkRehype, { allowDangerousHtml: true })
.use(rehypeRaw)
.use(rehypeStringify)
.use(unifiedPrettier);
const process = async (contents: VFileCompatible): Promise<VFileCompatible> => {
return compiler.process(contents).then((file) => file.value);
};
it("pass", async () => {
expect(await process({ path: 'output.html', value: "Hi" })).toBe("<p>Hi</p>");
}); The intention of this plugin is to work with |
I’m closing this, because there are better ways to use Prettier programmatically. |
I need a help.
I have a test file. I created a
compiler
and aprocess
function so as to use in the tests. Here is simplified version of my code.I couldn't figure out where to put
use(unifiedPrettier)
for specific to that example in order to prettify the output? I tried but got different errors.The text was updated successfully, but these errors were encountered: