-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix: fix Latex BuildException #7961
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
base: main
Are you sure you want to change the base?
Conversation
Reviewer's GuideIntroduces a preprocessing step in the MathEquationBlockComponentWidgetState to wrap imported LaTeX containing raw "\" line breaks in an aligned environment, preventing BuildException errors without altering the underlying rendering library. Sequence Diagram for LaTeX Preprocessing within _buildMathEquationsequenceDiagram
participant BME as _buildMathEquation
participant SL as _safeLatex
participant Renderer as Math.tex
BME->>SL: _safeLatex(formula)
activate SL
alt formula contains literal '\\\\' AND no literal '\\begin{'
SL->>SL: newFormula = "\\begin{aligned}" + formula + "\\end{aligned}"
SL-->>BME: newFormula
else formula is safe OR has existing environment
SL-->>BME: formula (unchanged)
end
deactivate SL
BME->>Renderer: tex(processedFormula)
activate Renderer
Renderer-->>BME: RenderedOutput
deactivate Renderer
Updated Class Diagram for MathEquationBlockComponentWidgetStateclassDiagram
class MathEquationBlockComponentWidgetState {
+Widget _buildMathEquation(BuildContext context)
-_safeLatex(String raw) String
}
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @M-T-Arden - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
...lugins/document/presentation/editor_plugins/math_equation/math_equation_block_component.dart
Outdated
Show resolved
Hide resolved
After fixing the LaTeX BuildException, the default right alignment for overflowed formulas may not meet users' needs. I adjusted this to left alignment (see the latest commit). |
PR Checklist
Summary by Sourcery
Bug Fixes:
BuildException
that occurs when importing LaTeX equations containing raw\\
line breaks from external sources (e.g., Notion). This fix introduces a preprocessing step that wraps such input in analigned
environment, preventingCrNode
exceptions without modifying the math rendering library.Summary by Sourcery
Prevent BuildException when rendering LaTeX equations containing raw '\' by wrapping them in an 'aligned' environment using a new preprocessing step.
Bug Fixes:
Enhancements: