Skip to content

Conversation

lipis
Copy link

@lipis lipis commented Nov 17, 2017

Prettier is now supporting Markdown since v1.8.0 and also formats the code inside the fences.

https://prettier.io

If something is actually breaking or it's wrong, please let me know as we can add a few ignore blocks in that case.

@lipis lipis requested review from a team November 17, 2017 00:58
@welcome
Copy link

welcome bot commented Nov 17, 2017

💖 Thanks for opening this pull request! 💖

Here is a list of things that will help get it across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.
    We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

| zh | Chinese |
| zh-CN | Chinese (Simplified) |
| zh-TW | Chinese (Traditional) |
| zu | Zulu |
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just beautiful :D

"printWidth": 80,
"proseWrap": false,
"semi": false,
"singleQuote": true
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the options that are used for Markdown and the code inside the fences. For more options check the full list: https://prettier.io/docs/en/options.html

@codebytere
Copy link
Member

Hi! We appreciate the contribution here but we have our own markdown linter and don’t use prettier as a format standard within our js. This PR unfortunately breaks our markdown parser and so at this time this isn’t something we think we can integrate.

@jkleinsc
Copy link
Member

Closing due to incompatibility with our markdown parser. Feel free to reopen if there is a way to make it work with our markdown parser.

@jkleinsc jkleinsc closed this Nov 17, 2017
@lipis
Copy link
Author

lipis commented Nov 17, 2017

Are you guys talking about the standard-markdown.. this from their README:

This module works just like standard, but instead of linting javascript files, it lints GitHub-Flavored js and javascript code blocks inside markdown files.

Which means that it is not actually formatting the markdown files but only the code inside of them.

What Prettier does on the other hand.. is actually normalising all the files and keeps the consistency among all of them. On top of that it also out of the box formats the code inside as well and I simply modified the options to match the standard format.. If that is not good enough (you can check the diffs).. I can update this and parse the files with standard-markdown to update the code in the desired format.

So basically Prettier does what standard-markdown is doing plus formatting the actual file.

@lipis
Copy link
Author

lipis commented Nov 17, 2017

I'm suggesting reconsider and of course I'm fully aware that the standard formatting is being used, but this PR is not affecting anything more than the Markdown files..

@jkleinsc
Copy link
Member

@lipis we do several things with our markdown files:

  1. We lint them against standard-markdown
  2. We generate an api file (electron-api.json)
  3. We generate typescript definitions

You can test all three of these by running npm run lint-docs. If that passes your change could be considered, but right now they are not passing.

@lipis
Copy link
Author

lipis commented Nov 17, 2017

OKey.. I'll take another look.. :)

@lipis
Copy link
Author

lipis commented Nov 17, 2017

So I'm getting these errors and there is no such option in Prettier.. is that really so important.. or this can be skipped?

...

> electron@1.8.2-beta.2 lint-js-in-markdown /Users/lipis/work/lipis/electron
> standard-markdown docs

   api/desktop-capturer.md
         38:22:    Missing space before function parentheses.
         44:21:    Missing space before function parentheses.

   api/menu.md
         148:14:   Missing space before function parentheses.

   api/protocol.md
         197:22:   Missing space before function parentheses.

   api/sandbox-option.md
         90:26:    Missing space before function parentheses.

   api/session.md
         362:25:   Missing space before function parentheses.
         366:13:   Missing space before function parentheses.
         370:13:   Missing space before function parentheses.

   api/web-frame.md
         77:13:    Missing space before function parentheses.

   development/build-system-overview.md
         68:39:    Missing space before function parentheses.

   tutorial/accessibility.md
         16:46:    Missing space before function parentheses.

   tutorial/desktop-environment-integration.md
         63:10:    Missing space before function parentheses.
         144:10:   Missing space before function parentheses.
         152:10:   Missing space before function parentheses.

   tutorial/planned-breaking-changes.md
         122:38:   Missing space before function parentheses.
         126:38:   Missing space before function parentheses.

   tutorial/quick-start.md
         61:22:    Missing space before function parentheses.

   tutorial/using-selenium-and-webdriver.md
         26:17:    Missing space before function parentheses.
         30:17:    Missing space before function parentheses.
         34:17:    Missing space before function parentheses.
         38:17:    Missing space before function parentheses.
         42:18:    Missing space before function parentheses.
         46:17:    Missing space before function parentheses.

There are 23 errors in "docs"

@jkleinsc
Copy link
Member

@lipis yup... they are important as they are needed in the generation of the api file and typescript definitions.

@lipis
Copy link
Author

lipis commented Nov 17, 2017

Let's have this one open for a while.. maybe we'll get somewhere #11156 /cc @ikatyang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants