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

Running Prettier against the docs caused breaking changes #56

Open
mqnguyen5 opened this issue Nov 9, 2021 · 0 comments
Open

Running Prettier against the docs caused breaking changes #56

mqnguyen5 opened this issue Nov 9, 2021 · 0 comments

Comments

@mqnguyen5
Copy link
Contributor

mqnguyen5 commented Nov 9, 2021

This is a sub-issue of #18 and #24.

Settings

Prettier config file:

{
  "arrowParens": "always",
  "bracketSpacing": true,
  "embeddedLanguageFormatting": "auto",
  "endOfLine": "lf",
  "htmlWhitespaceSensitivity": "css",
  "insertPragma": false,
  "jsxBracketSameLine": false,
  "jsxSingleQuote": false,
  "proseWrap": "preserve",
  "quoteProps": "as-needed",
  "requirePragma": false,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "es5",
  "useTabs": false,
  "vueIndentScriptAndStyle": false,
  "printWidth": 100
}

Prettier ignore file:

# Dependencies
/node_modules
package.json
package-lock.json
yarn.lock

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
/static
CNAME
vercel.json

Scripts:

"prettier": "prettier --write \"./**/*.{md,jsx,json,html,css,js,yml}\"",
"prettier-check": "prettier --check \"./**/*.{md,jsx,json,html,css,js,yml}\"",

Problem

When running npm run prettier, Prettier accidentally changes the asterisk * (used for representing multiplication) into - or _, as it thought that those * indicates a bulleted list or italic letters

Demo:

// Before running `npm run prettier`
* Giga or G (=1024M): 1 Gigabyte = 1024 * 1024 * 1024 bytes ~ 10<sup>9</sup> bytes

// After running `npm run prettier`
* Giga or G (=1024M): 1 Gigabyte = 1024 _ 1024 _ 1024 bytes ~ 10<sup>9</sup> bytes

Suggested Solutions:

For anyone who is working on parts of #18 , make sure to have Prettier installed with the above settings, and ran npm run prettier after you have finished making changes to the Markdown. Locate any special characters that you don't want to be formatted by Prettier and escapes them with \.

Places with the bug:

  • docs/A-Introduction/information.md
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

No branches or pull requests

1 participant