Skip to content
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

Add a flag to skip formatting the code inside the Markdown files #3284

Closed
lipis opened this issue Nov 17, 2017 · 9 comments
Closed

Add a flag to skip formatting the code inside the Markdown files #3284

lipis opened this issue Nov 17, 2017 · 9 comments
Labels
area:multiparser Issues with printing one language inside another, like CSS-in-JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:needs discussion Issues needing discussion and a decision to be made before action can be taken type:option request Issues requesting a new option. We generally don’t accept these unless there is technical necessity.

Comments

@lipis
Copy link
Member

lipis commented Nov 17, 2017

If you ask me to personally, TBH I don't really need this option.. but I can see that in some cases you might don't want to reformat your code inside the documentation for your own reasons.. One example can be found here and I'm not sure how to fix it :)

electron/electron#11143

WDYT?

@lydell
Copy link
Member

lydell commented Nov 17, 2017

I think it is better to close this and only add an option when somebody that wants it asks for it.

@ikatyang
Copy link
Member

This flag should be useful for someone only cares about the markdown formatting and they have their own js coding style that is conflict with Prettier.

The implementation should be pretty easy, just adding a condition to not enter the subtree-parser, but I'm not sure what should we name it, --no-multi-parser?

function getSubtreeParser(path, options) {
switch (options.parser) {
case "parse5":
return fromHtmlParser2(path, options);
case "babylon":
case "flow":
case "typescript":
return fromBabylonFlowOrTypeScript(path, options);
case "markdown":
return fromMarkdown(path, options);
}
}

@ikatyang ikatyang added area:multiparser Issues with printing one language inside another, like CSS-in-JS status:needs discussion Issues needing discussion and a decision to be made before action can be taken type:enhancement A potential new feature to be added, or an improvement to how we print something type:option request Issues requesting a new option. We generally don’t accept these unless there is technical necessity. and removed type:enhancement A potential new feature to be added, or an improvement to how we print something labels Nov 18, 2017
@lipis
Copy link
Member Author

lipis commented Nov 19, 2017

Maybe something with code fences no-style-code? Yes I think there is a case for the need of this option.

@azz
Copy link
Member

azz commented Nov 19, 2017

What's wrong with <!-- prettier-ignore -->? Doesn't seem like we need an option for this...

@lipis
Copy link
Member Author

lipis commented Nov 19, 2017

if you have a big codebase with documentation and lots of code for this could be annoying..

@suchipi
Copy link
Member

suchipi commented Nov 19, 2017

@lipis For that electron case, eslint could add the spaces in function declarations after a prettier run... but I dunno if eslint can format code within markdown code blocks.

@lipis
Copy link
Member Author

lipis commented Nov 20, 2017

eslint is parsing .js files and not .md so I'm not sure if we can do anything about it.

@azz
Copy link
Member

azz commented Nov 21, 2017

@suchipi

I dunno if eslint can format code within markdown code blocks.

https://github.com/eslint/eslint-plugin-markdown

@lipis
Copy link
Member Author

lipis commented Nov 21, 2017

Electron closed that issue electron/electron#11156 so I will close this one as well and in case somebody is going to need that flag we can rethink of it.. until then 🍻 🍺

@lipis lipis closed this as completed Nov 21, 2017
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jul 6, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:multiparser Issues with printing one language inside another, like CSS-in-JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:needs discussion Issues needing discussion and a decision to be made before action can be taken type:option request Issues requesting a new option. We generally don’t accept these unless there is technical necessity.
Projects
None yet
Development

No branches or pull requests

5 participants