-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Prettier Markdown files #3022
Prettier Markdown files #3022
Conversation
### ifBreak | ||
|
||
Prints something if the current group breaks and something else if it doesn't. | ||
|
||
```js | ||
ifBreak(";", " ") | ||
ifBreak(";", " "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, these are kind of expressions. Not statements, which is probably why there wasn't a semicolon here. Not the end of the world, I guess.
|
||
#### Option 2. [pre-commit](https://github.com/pre-commit/pre-commit) | ||
|
||
Copy the following config into your `.pre-commit-config.yaml` file: | ||
|
||
```yaml | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a bug, @ikatyang?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the leading/trailing new line does nothing there.
@@ -4,36 +4,41 @@ | |||
<summary><strong>Table of Contents</strong></summary> | |||
|
|||
- [Vim and Prettier integration](#vim-and-prettier-integration) | |||
* [Neoformat](#neoformat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is autogenerated so should be ignored.
|
||
vim-prettier executable resolution: | ||
|
||
1. Tranverse parents and search for Prettier installation inside `node_modules` | ||
2. Look for a global prettier installation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think we should preserve this choice @ikatyang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add an option for it? or just print ordered numbers if the second number equals the first number +1?
EDIT: auto-detection should be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say a good enough heuristic could be always use 1.
iff items[1].number === "1."
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #3024
Include this anywhere to force all parent groups to break. See `group` | ||
for more info. Example: | ||
Include this anywhere to force all parent groups to break. See `group` for more | ||
info. Example: | ||
|
||
```js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.. maybe you can delete this comment so it won't confuse us
commands.md
Outdated
|
||
```js | ||
concat(["{", lineSuffix(" // comment"), lineSuffixBoundary, "}", hardline]) | ||
concat(["{", lineSuffix(" // comment"), lineSuffixBoundary, "}", hardline]); | ||
``` | ||
|
||
will output | ||
|
||
```js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this block
commands.md
Outdated
``` | ||
|
||
will output | ||
|
||
```js | ||
{ // comment | ||
{ | ||
// comment | ||
} | ||
``` | ||
|
||
and **not** | ||
|
||
```js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this block
docs/usage.md
Outdated
|
||
## Excluding code from formatting | ||
|
||
A JavaScript comment of `// prettier-ignore` will exclude the next node in the abstract syntax tree from formatting. | ||
A JavaScript comment of `// prettier-ignore` will exclude the next node in the | ||
abstract syntax tree from formatting. | ||
|
||
For example: | ||
|
||
```js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this block
@@ -2,748 +2,769 @@ | |||
|
|||
[link](https://github.com/prettier/prettier/compare/1.7.3...1.7.4) | |||
|
|||
* Force template literals to break after \` for styled-components (#2926 by duailibe) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ikatyang Should we pick *
as unordered list instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should do some research for this too, just like the decision we made for strong/emphasis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done! #2943 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #3025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. As you mentioned there are a handful of places we want to ignore.
@@ -1,45 +1,59 @@ | |||
## Configure External Tool | |||
|
|||
https://blog.jetbrains.com/webstorm/2016/08/using-external-tools/ | |||
[https://blog.jetbrains.com/webstorm/2016/08/using-external-tools/](https://blog.jetbrains.com/webstorm/2016/08/using-external-tools/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug, we should print it with shortcut-style, i.e. <https://...>
, opened #3030.
…ettier/md * 'master' of https://github.com/prettier/prettier: feat(cli): add `--loglevel` option (prettier#2992)
also I'm not sure how to incorporate markdown with the precommit hook.. but maybe we can do that after the official release.. |
@lipis there have been some changes to Markdown since you opened this PR. Did you want to re-run this with the current |
yes I will do that once I'll get in front of my computer.. |
should I fix anything else? |
Yes, we need to figure out how to fix the "TOC should be up-to-date" test (which currently causes Travis to fail). |
Would this work? <!-- prettier-ignore -->
<details>
... |
would be nice.. html support is coming soon as well as it looks like ;) |
README.md
Outdated
|
||
For example: | ||
|
||
```js | ||
matrix( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block need to be <-- prettier-ignore -->
d.
README.md
Outdated
@@ -731,8 +878,8 @@ The options to the configuration file are the same the [API options](#options). | |||
JSON: | |||
|
|||
```json | |||
// .prettierrc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want this comment to move. Perhaps <!-- prettier-ignore -->
this too.
editors/atom.md
Outdated
@@ -1 +1,2 @@ | |||
See https://github.com/prettier/prettier-atom | |||
See | |||
[https://github.com/prettier/prettier-atom](https://github.com/prettier/prettier-atom) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ikatyang This one intentional? I thought it was fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems @lipis is still using the old prettier? The list style in this PR is still -
, and so does this link.
…ettier/md * 'master' of https://github.com/prettier/prettier: Fix util.getStringWidth for falsy input (prettier#3092)
Updated.. the following didn't work.. so I rerun the
|
README.md
Outdated
@@ -640,7 +640,12 @@ abstract syntax tree from formatting. | |||
For example: | |||
|
|||
```js | |||
matrix(1, 0, 0, 0, 1, 0, 0, 0, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ignore comment needs to be above the fence otherwise it will show up in the rendered version.
README.md
Outdated
@@ -878,9 +878,9 @@ The options to the configuration file are the same the [API options](#options). | |||
JSON: | |||
|
|||
```json | |||
{ | |||
<!-- prettier-ignore --> | |||
// .prettierrc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Ignore needs to move above ```json
I think it's ready |
I think it'd be better to wait for the 1.8 release (or use current |
Makes sense! |
I think I will close that.. but the issue still remains.. we need to format all the md files with Prettier.. and use hooks for the future ones.. |
Some of the JS examples though must be ignored.
Let me know what would be the default print size and I'll edit the JS examples that needs to be reverted and not prettified.