Skip to content

Running Prettier against the docs caused breaking changes #56

Description

@mqnguyen5

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions