Added free-text and free-math modes (multiline latex support) - #3060
Open
Shrookin wants to merge 3 commits into
Open
Added free-text and free-math modes (multiline latex support)#3060Shrookin wants to merge 3 commits into
Shrookin wants to merge 3 commits into
Conversation
Shrookin
marked this pull request as ready for review
August 21, 2026 04:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two experimental multiline mathfield modes:
free-text: prose-first editing with inline LaTeX escapes.free-math: math-first editing with multiline rows and inline text islands.Both modes use a multiline root represented as an array of rows, preserving the document's line structure rather than flattening it into a single mathfield row.
free-textfree-textis intended for document-like editing while retaining MathLive's rendering and editing engine.free-mathfree-mathis intended for math-oriented multiline input.\\text{...}.Keyboard compatibility
Free modes use document-editing semantics for their primary keys:
textandmathmodes keep their existing behavior unchanged.This keeps placeholder/group navigation and explicit commit behavior available without taking Tab and Enter away from multiline editing.
Serialization and public API
free-textandfree-mathto the publicParseModeanddefaultModetypes.setValue()respects the configured free mode and parses replacement values with the correct semantics.Implementation
The implementation reuses MathLive's existing multiline row/environment mechanics while introducing a dedicated free-mode root/parser layer. Rendering and serialization recognize both free modes as their corresponding text or math families, while the editor retains the mode distinction needed for keyboard input, LaTeX escapes, styling, and output.
Tests
The feature is intentionally marked experimental for maintainer review.