-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Feat run prettier on markdown #3093
Conversation
… and created config file
…ell as added hot key option. Partial Implementation of Prettier config in configuration screen. TODO Fix defaulting of prettier configuration
browser/components/CodeEditor.js
Outdated
@@ -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') |
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.
Can you replace this with import
statement?
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.
Addressed in #bde357f
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.
Great!
browser/main/lib/ConfigManager.js
Outdated
"tabWidth": 4, | ||
"semi": false, | ||
"singleQuote": true, | ||
"parser":"markdown" |
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.
Can you append this parser
option at the end? Because this will never change so we should make it default.
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.
@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?
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.
Assuming i understood the comment correctly this should be addressed in #1d59d89
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.
Yep that's exactly what I wanted, thank you!
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? |
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:
it should produce this:
|
@ZeroX-DG i just tried the table you had and it works ok for me? What do you have as your default? |
@ZeroX-DG have you had a chance to look at this? |
@nathan-castlehow sorry for the late review. I found out about the reason behind this. If you have a line directly above the table then it will not format the table (or maybe format it wrongly).
The code above will make the table to format wrongly. Is this a prettier bug or intended behavior? |
Hi @ZeroX-DG, no worries.
|
Hmm...let's just say it's upstream issue for now. Can you fix the conflict so I can aprove it? @nathan-castlehow |
… and created config file
…ell as added hot key option. Partial Implementation of Prettier config in configuration screen. TODO Fix defaulting of prettier configuration
…er set to markdown when used.
…than-castlehow/Boostnote into feat-run-prettier-on-markdown
@ZeroX-DG Should be all sorted now. Still understanding the ropes of git (use tfs at work) so apologies in advance if there are any issues. Let me know if you need me to fix anything. |
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.
LGTM 🎉
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.
Issue fixed
#3039
Type of changes
Checklist:
IssueHunt Summary
Referenced issues
This pull request has been submitted to:
IssueHunt has been backed by the following sponsors. Become a sponsor