diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index 51afd79a3..318c1fa06 100644 --- a/.github/ISSUE_TEMPLATE/formatting.md +++ b/.github/ISSUE_TEMPLATE/formatting.md @@ -26,7 +26,7 @@ Don't fill the form below manually! Let a program create a report for you: --> -**Prettier 3.9.8** +**Prettier 3.9.9** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index 7159721e9..eecc04a51 100644 --- a/.github/ISSUE_TEMPLATE/integration.md +++ b/.github/ISSUE_TEMPLATE/integration.md @@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE: **Environments:** -- Prettier Version: 3.9.8 +- Prettier Version: 3.9.9 - Running Prettier via: - Runtime: - Operating System: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ee7ce72d..dce14e5f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +# 3.9.9 + +[diff](https://github.com/prettier/prettier/compare/3.9.8...3.9.9) + +#### Markdown: Fix text with `$` been incorrectly parsed as math syntax ([#20140](https://github.com/prettier/prettier/pull/20140) by [@fisker](https://github.com/fisker)) + + +```md + +**Uses $FOO** from `a.sh` and `b.sh`, plus `$BAR` from `c.sh`, before anything else runs here. + + +**Uses $FOO** from `a.sh` and `b.sh`, plus `$BAR`from`c.sh`, before anything else runs here. + + +**Uses $FOO** from `a.sh` and `b.sh`, plus `$BAR` from `c.sh`, before anything else runs here. +``` + # 3.9.8 [diff](https://github.com/prettier/prettier/compare/3.9.7...3.9.8) diff --git a/package.json b/package.json index db76f2c95..da93dfdb3 100644 --- a/package.json +++ b/package.json @@ -182,7 +182,7 @@ "node-style-text": "2.1.2", "npm-run-all2": "9.0.3", "open-editor": "6.0.0", - "prettier": "3.9.8", + "prettier": "3.9.9", "pretty-bytes": "7.1.3", "pretty-ms": "9.3.1", "puppeteer": "25.11.0", diff --git a/src/language-markdown/parse/parse-markdown.js b/src/language-markdown/parse/parse-markdown.js index ba7f76a2b..32888ee21 100644 --- a/src/language-markdown/parse/parse-markdown.js +++ b/src/language-markdown/parse/parse-markdown.js @@ -17,7 +17,7 @@ function getMarkdownParseOptions() { return (markdownParseOptions ??= { extensions: [ gfmSyntax({ singleTilde: false }), - mathSyntax(), + mathSyntax({ singleDollarTextMath: false }), wikiLinkSyntax({ // We don't need support alias, use a fake string to bypass // https://github.com/stereobooster/braindb/blob/66d6cf74d0bad43f20924a14e382a432ff81cdfa/packages/micromark-extension-wiki-link/src/syntax.ts#L81 diff --git a/tests/format/markdown/math/__snapshots__/format.test.js.snap b/tests/format/markdown/math/__snapshots__/format.test.js.snap index 291f12842..84fa7c571 100644 --- a/tests/format/markdown/math/__snapshots__/format.test.js.snap +++ b/tests/format/markdown/math/__snapshots__/format.test.js.snap @@ -66,6 +66,27 @@ $$ \\textrm{p-value} = 1 - \\sum_{x \\leq a} H(x | N, r_1, m_1) $$ ================================================================================ `; +exports[`issue-20135.md format 1`] = ` +====================================options===================================== +parsers: ["markdown"] + printWidth: 80 (default) | +=====================================input====================================== +**Uses $FOO** from \`a.sh\` and \`b.sh\`, plus \`$BAR\` from \`c.sh\`, before anything else runs here. + +**Sourced-from-$DOTFILES files** - listed in \`.stow-local-ignore\`. They live only inside the repo +and are pulled in by \`.zshrc\` via \`$DOTFILES\` (which is set to \`~/.dotfiles\` in \`.zshrc\`). Key +examples: \`exports.zsh\`, \`aliases.zsh\`, \`dirs.zsh\`, \`completions/\`, \`_plugins/loader.zsh\`. + +=====================================output===================================== +**Uses $FOO** from \`a.sh\` and \`b.sh\`, plus \`$BAR\` from \`c.sh\`, before anything else runs here. + +**Sourced-from-$DOTFILES files** - listed in \`.stow-local-ignore\`. They live only inside the repo +and are pulled in by \`.zshrc\` via \`$DOTFILES\` (which is set to \`~/.dotfiles\` in \`.zshrc\`). Key +examples: \`exports.zsh\`, \`aliases.zsh\`, \`dirs.zsh\`, \`completions/\`, \`_plugins/loader.zsh\`. + +================================================================================ +`; + exports[`math-like.md format 1`] = ` ====================================options===================================== parsers: ["markdown"] @@ -78,7 +99,7 @@ Paragraph with $14 million. But if more $dollars on the same line... =====================================output===================================== $10 - $20 -Paragraph with $14 million. But if more $dollars on the same line... +Paragraph with $14 million. But if more $dollars on the same line... ================================================================================ `; diff --git a/tests/format/markdown/math/issue-20135.md b/tests/format/markdown/math/issue-20135.md new file mode 100644 index 000000000..87b1a94db --- /dev/null +++ b/tests/format/markdown/math/issue-20135.md @@ -0,0 +1,5 @@ +**Uses $FOO** from `a.sh` and `b.sh`, plus `$BAR` from `c.sh`, before anything else runs here. + +**Sourced-from-$DOTFILES files** - listed in `.stow-local-ignore`. They live only inside the repo +and are pulled in by `.zshrc` via `$DOTFILES` (which is set to `~/.dotfiles` in `.zshrc`). Key +examples: `exports.zsh`, `aliases.zsh`, `dirs.zsh`, `completions/`, `_plugins/loader.zsh`. diff --git a/website/versioned_docs/version-stable/browser.md b/website/versioned_docs/version-stable/browser.md index 0bed0c14c..7d99f1bd2 100644 --- a/website/versioned_docs/version-stable/browser.md +++ b/website/versioned_docs/version-stable/browser.md @@ -21,7 +21,7 @@ Required options: - **[`parser`](options.md#parser) (or [`filepath`](options.md#file-path))**: One of these options has to be specified for Prettier to know which parser to use. -- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource-options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in [https://unpkg.com/browse/prettier@3.9.8/plugins](https://unpkg.com/browse/prettier@3.9.8/plugins). Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON. +- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource-options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in [https://unpkg.com/browse/prettier@3.9.9/plugins](https://unpkg.com/browse/prettier@3.9.9/plugins). Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON. You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option. @@ -32,8 +32,8 @@ See below for examples. ### Global ```html - - + +