From 20108545d8e23a830fff1ae34756e7e386be909c Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Tue, 26 Mar 2024 11:34:51 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AE=20Fix=20math-spacing=20in=20paragr?= =?UTF-8?q?aphs=20(#1032)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/chilled-tigers-fail.md | 5 + .changeset/hip-zoos-thank.md | 5 + .changeset/honest-penguins-shave.md | 5 + .changeset/modern-frogs-join.md | 5 + .changeset/nasty-forks-look.md | 5 + .changeset/popular-chairs-swim.md | 5 + .changeset/rich-waves-taste.md | 5 + .changeset/stale-wolves-lie.md | 5 + .changeset/thirty-months-pretend.md | 5 + packages/markdown-it-myst/src/directives.ts | 16 ++ .../markdown-it-myst/tests/directives.spec.ts | 15 ++ packages/myst-common/src/types.ts | 2 +- packages/myst-directives/src/math.ts | 19 ++- packages/myst-parser/src/fromMarkdown.ts | 23 ++- packages/myst-parser/src/myst.ts | 2 +- packages/myst-parser/src/tokensToMyst.ts | 34 +++- packages/myst-parser/src/types.ts | 8 +- .../tests/directives/directives.spec.ts | 12 +- .../myst-parser/tests/directives/math.yml | 31 ++++ packages/myst-parser/tests/math.spec.ts | 42 +++++ packages/myst-parser/tests/myst.spec.ts | 36 ++-- packages/myst-spec-ext/src/types.ts | 1 + packages/myst-to-tex/src/math.ts | 13 +- packages/myst-to-tex/tests/math.spec.ts | 16 ++ packages/myst-transforms/src/math.spec.ts | 155 ++++++++++++++---- packages/myst-transforms/src/math.ts | 28 ++++ packages/mystmd/tests/basic-tex-math/input.md | 19 +++ packages/mystmd/tests/basic-tex-math/myst.yml | 8 + packages/mystmd/tests/exports.yml | 6 + .../mystmd/tests/outputs/basic-tex-math.tex | 19 +++ 30 files changed, 480 insertions(+), 70 deletions(-) create mode 100644 .changeset/chilled-tigers-fail.md create mode 100644 .changeset/hip-zoos-thank.md create mode 100644 .changeset/honest-penguins-shave.md create mode 100644 .changeset/modern-frogs-join.md create mode 100644 .changeset/nasty-forks-look.md create mode 100644 .changeset/popular-chairs-swim.md create mode 100644 .changeset/rich-waves-taste.md create mode 100644 .changeset/stale-wolves-lie.md create mode 100644 .changeset/thirty-months-pretend.md create mode 100644 packages/myst-parser/tests/math.spec.ts create mode 100644 packages/mystmd/tests/basic-tex-math/input.md create mode 100644 packages/mystmd/tests/basic-tex-math/myst.yml create mode 100644 packages/mystmd/tests/outputs/basic-tex-math.tex diff --git a/.changeset/chilled-tigers-fail.md b/.changeset/chilled-tigers-fail.md new file mode 100644 index 000000000..a8a6f8c35 --- /dev/null +++ b/.changeset/chilled-tigers-fail.md @@ -0,0 +1,5 @@ +--- +"myst-to-tex": patch +--- + +Respect math node tightness diff --git a/.changeset/hip-zoos-thank.md b/.changeset/hip-zoos-thank.md new file mode 100644 index 000000000..f7c21ed51 --- /dev/null +++ b/.changeset/hip-zoos-thank.md @@ -0,0 +1,5 @@ +--- +"myst-spec-ext": patch +--- + +Add tightness to math node extension diff --git a/.changeset/honest-penguins-shave.md b/.changeset/honest-penguins-shave.md new file mode 100644 index 000000000..8398efac0 --- /dev/null +++ b/.changeset/honest-penguins-shave.md @@ -0,0 +1,5 @@ +--- +"markdown-it-myst": patch +--- + +Add block tightness to the directives diff --git a/.changeset/modern-frogs-join.md b/.changeset/modern-frogs-join.md new file mode 100644 index 000000000..1326e324d --- /dev/null +++ b/.changeset/modern-frogs-join.md @@ -0,0 +1,5 @@ +--- +"myst-directives": patch +--- + +Add math tightness to the directive diff --git a/.changeset/nasty-forks-look.md b/.changeset/nasty-forks-look.md new file mode 100644 index 000000000..0135088a5 --- /dev/null +++ b/.changeset/nasty-forks-look.md @@ -0,0 +1,5 @@ +--- +"myst-parser": patch +--- + +Pass src to the state handlers diff --git a/.changeset/popular-chairs-swim.md b/.changeset/popular-chairs-swim.md new file mode 100644 index 000000000..2c8501e5b --- /dev/null +++ b/.changeset/popular-chairs-swim.md @@ -0,0 +1,5 @@ +--- +"mystmd": patch +--- + +Handle math tightness for latex diff --git a/.changeset/rich-waves-taste.md b/.changeset/rich-waves-taste.md new file mode 100644 index 000000000..8d7b33c45 --- /dev/null +++ b/.changeset/rich-waves-taste.md @@ -0,0 +1,5 @@ +--- +"myst-parser": patch +--- + +compute AMS math tightness based on source diff --git a/.changeset/stale-wolves-lie.md b/.changeset/stale-wolves-lie.md new file mode 100644 index 000000000..f4d21bfe2 --- /dev/null +++ b/.changeset/stale-wolves-lie.md @@ -0,0 +1,5 @@ +--- +"myst-transforms": patch +--- + +Keep math tightness when lifting from paragraphs diff --git a/.changeset/thirty-months-pretend.md b/.changeset/thirty-months-pretend.md new file mode 100644 index 000000000..a732d31d3 --- /dev/null +++ b/.changeset/thirty-months-pretend.md @@ -0,0 +1,5 @@ +--- +"myst-common": patch +--- + +Add block tightness to the directive data diff --git a/packages/markdown-it-myst/src/directives.ts b/packages/markdown-it-myst/src/directives.ts index 1b66cead2..cdc07435e 100644 --- a/packages/markdown-it-myst/src/directives.ts +++ b/packages/markdown-it-myst/src/directives.ts @@ -8,6 +8,20 @@ import { stateError, stateWarn } from './utils.js'; const COLON_OPTION_REGEX = /^:(?