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

Feat run prettier on markdown #3093

Open
wants to merge 9 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@nathan-castlehow
Copy link

commented Jun 23, 2019

Description

Adds support for Prettier in editor to "Prettify" Markdown.
Hotkey option available in config. Prettier Config json also available in config.
Runs prettier over current markdown with configured prettier options.

prettier

Issue fixed

#3039

Type of changes

  • ⚪️ Bug fix (Change that fixed an issue)
  • ⚪️ Breaking change (Change that can cause existing functionality to change)
  • ⚪️ Improvement (Change that improves the code. Maybe performance or development improvement)
  • 🔘 Feature (Change that adds new functionality)
  • ⚪️ Documentation change (Change that modifies documentation. Maybe typo fixes)

Checklist:

  • 🔘 My code follows the project code style
  • ⚪️ I have written test for my code and it has been tested
  • 🔘 All existing tests have been passed
  • 🔘 I have attached a screenshot/video to visualize my change if possible

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

@@ -28,6 +28,7 @@ import {generateInEditor, tocExistsInEditor} from 'browser/lib/markdown-toc-gene
import markdownlint from 'markdownlint'
import Jsonlint from 'jsonlint-mod'
import { DEFAULT_CONFIG } from '../main/lib/ConfigManager'
const prettier = require('prettier')

This comment has been minimized.

Copy link
@ZeroX-DG

ZeroX-DG Jul 2, 2019

Member

Can you replace this with import statement?

This comment has been minimized.

Copy link
@nathan-castlehow

nathan-castlehow Jul 3, 2019

Author

Addressed in #bde357f

This comment has been minimized.

Copy link
@ZeroX-DG

ZeroX-DG Jul 3, 2019

Member

Great!

"tabWidth": 4,
"semi": false,
"singleQuote": true,
"parser":"markdown"

This comment has been minimized.

Copy link
@ZeroX-DG

ZeroX-DG Jul 2, 2019

Member

Can you append this parser option at the end? Because this will never change so we should make it default.

This comment has been minimized.

Copy link
@nathan-castlehow

nathan-castlehow Jul 2, 2019

Author

@ZeroX-DG do you mean as in don't have it in the options that show up in the config and then append the parser property before use?

This comment has been minimized.

Copy link
@nathan-castlehow

nathan-castlehow Jul 3, 2019

Author

Assuming i understood the comment correctly this should be addressed in #1d59d89

This comment has been minimized.

Copy link
@ZeroX-DG

ZeroX-DG Jul 3, 2019

Member

Yep that's exactly what I wanted, thank you!

@ZeroX-DG

This comment has been minimized.

Copy link
Member

commented Jul 7, 2019

One more small request, can you trigger the format table too? Currently it doesn't format the table.

@nathan-castlehow

This comment has been minimized.

Copy link
Author

commented Jul 7, 2019

One more small request, can you trigger the format table too? Currently it doesn't format the table.

@ZeroX-DG Do you have sample markdown and expected results? I assume we are meaning its not correctly formatting a markdown table?

@ZeroX-DG

This comment has been minimized.

Copy link
Member

commented Jul 7, 2019

I never used prettier to format markdown before so I didn't realized that they have support for table. However, in this case the table is not formatted with the default config. Here's my input:

|asd| asdasd|
|---|--------|
|asd|asdasdasd|
|dasd|ASdasdasd|

it should produce this:

| asd  | asdasd    |
| ---- | --------- |
| asd  | asdasdasd |
| dasd | ASdasdasd |
@nathan-castlehow

This comment has been minimized.

Copy link
Author

commented Jul 8, 2019

@ZeroX-DG i just tried the table you had and it works ok for me?
My default config is
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": true
}

What do you have as your default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.