You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 examples dir. These examples (all files in this directory) could be run through Prettier automatically.
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 js{2, 7} - might want to watch out to make sure Prettier recognizes them.
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:
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).
Activity
bvaughn commentedon Nov 20, 2017
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
examplesdir. These examples (all files in this directory) could be run through Prettier automatically.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.
clemmy commentedon Nov 20, 2017
Pretty cool: https://github.com/prettier/prettier/releases/tag/1.8.0
alexkrolick commentedon Nov 20, 2017
One thing I noticed is that some of the js code blocks have special tags like
js{2, 7}- might want to watch out to make sure Prettier recognizes them.bvaughn commentedon Nov 23, 2017
First step to what I described would be to get Prettier running on our example code, which I've done with PR #331.
bvaughn commentedon Nov 24, 2017
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:
bvaughn commentedon Nov 24, 2017
Related PR #336
bvaughn commentedon Nov 29, 2017
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).
alexkrolick commentedon Mar 14, 2018
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
javascript{2-4}as a JS block (nor do editors...).Merge pull request reactjs#310 from reactjs/sync-941f5418
ashutosh887 commentedon Mar 19, 2023
@bvaughn @gaearon Please close the Issue if resolved
if not, I would like to work on the issue
docs(cn):fix firefox misspelled (reactjs#310)