-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Run examples in Markdown through Prettier #310
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
Comments
Kind of related to this, but, I was planning to write a little Gatsby Remark plug-in that let us directly embed examples from the This won't solve all problems, since it's a bit too much overhead to create an example file for a couple of lines, but it would help with the larger ones. |
One thing I noticed is that some of the js code blocks have special tags like |
First step to what I described would be to get Prettier running on our example code, which I've done with PR #331. |
Regarding Prettier 1.8's ability to format Markdown files - it looks like it chokes on the ones we have here because of the "frontmatter" header blocks, eg:
|
Related PR #336 |
We might be able to draw some inspiration from this project in terms of running only the code blocks through Prettier. Not sure how straight forward this would be to do, given that multiple Gatsby plugins touch our code blocks. It might also complicate line-highlights since those are line-number based (at least until the Gatsby plugin supports the newer inline comment syntax). |
This seems to be working now even with frontmatter: npx prettier --parser=markdown --write "content/docs/**/*.md"
The line-highlights are still problematic though, since the markdown parser doesn't recognize |
@bvaughn and anybody reading this thread: prettier-markdown recommends to use prettier directly
|
Sync with reactjs.org @ 941f541
Not sure how to do it but I think I've seen some tweet saying you can run Markdown files through Prettier and it will format JS blocks.
The text was updated successfully, but these errors were encountered: