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

Fixed Content on Same Line as Math Block Indicator Getting Put At Start of Each Line Outside of a Blockquote for Inline Math for Moving Math Indicators to Their Own Lines #1002

Merged
merged 3 commits into from
Jan 27, 2024

Conversation

pjkaufman
Copy link
Collaborator

Fixes #996

There was an issue where if you had inline math present with other content on the line, if it met the conditions for converting to a math block, it would copy over the content on the same line, but prior to the opening math blocks.

For example, a $$b$$ would become:

a 
a $$
a b
a $$

This was fixed by getting the start of the line as either whitespace or blockquote indicators.

Thus it now becomes

a
$$
b
$$

I also addressed the more complex blockquote scenario to properly get the blockquote indicators.

> Here is a math block: $$a$$

now becomes

> Here is a math block:
> $$
> a
> $$

The logic also tries to cleanup whitespace that was present between the opening math block indicator and the content on the same line.

For example,

Here is a math block             $$b$$

becomes

Here is a math block
$$
b
$$

Changes Made:

  • Reworked the logic for moving math block indicators to remove whitespace that was between line content and the opening math block indicators
  • Reworked the logic to make it handle more blockquote and regular markdown scenarios
  • Added UTs for a couple scenarios to make sure it worked
  • Moved regex to the regex helper file

@pjkaufman pjkaufman added bug Something isn't working markdown General Markdown or Markdown related issue or feature labels Jan 27, 2024
@pjkaufman pjkaufman self-assigned this Jan 27, 2024
@pjkaufman pjkaufman merged commit 4cd434c into platers:master Jan 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working markdown General Markdown or Markdown related issue or feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Move Math Block Indicators to Their Own Line duplicates text before block math delimiter
1 participant