Skip to content

Enhance MarkdownText with LaTeX support#441

Draft
samrudha01codespace wants to merge 1 commit intogoogle-ai-edge:mainfrom
samrudha01codespace:main
Draft

Enhance MarkdownText with LaTeX support#441
samrudha01codespace wants to merge 1 commit intogoogle-ai-edge:mainfrom
samrudha01codespace:main

Conversation

@samrudha01codespace
Copy link
Copy Markdown

This pull request significantly enhances the MarkdownText composable in MarkdownText.kt by adding LaTeX math expression support and improving Markdown rendering. It introduces a helper for converting common LaTeX math to Unicode, processes inline math in Markdown, and adds previews and theming improvements. The changes also refactor imports and update styling for better integration with the app's theme.

LaTeX and Math Rendering Enhancements:

  • Added a convertLatexToUnicode helper function to translate common LaTeX math expressions (Greek letters, operators, superscripts, subscripts, fractions) into Unicode equivalents. This enables basic math rendering within Markdown content.
  • Updated the MarkdownText composable to process and replace inline LaTeX expressions (e.g., `$...
    ) with their Unicode representations before rendering.
  • Added a MathExpression composable for rendering block and inline math with appropriate styling, though only inline math is currently handled in the Markdown.

UI and Theming Improvements:

  • Updated code block and link styling within Markdown to use the app’s theme colors and improved padding and font settings for better readability.
  • Switched to using OfflineLLMTheme and reorganized the file’s import structure for consistency with the rest of the app. [1] [2]

Developer Experience:

  • Added new preview composables (MarkdownTextPreview, SimpleTutorialButton) to showcase Markdown with math examples and demonstrate the new features in the UI.

Refactoring and Cleanup:

  • Removed unused or outdated code, such as the old preview and references to the previous theme system.

File Organization:

  • Moved the file to the com.genzopia.offlineai.Design package and updated the package declaration accordingly.

Refactor MarkdownText to support LaTeX expressions and improve structure.
@samrudha01codespace samrudha01codespace marked this pull request as draft February 20, 2026 14:47
@samrudha01codespace samrudha01codespace marked this pull request as ready for review February 20, 2026 14:47
@samrudha01codespace samrudha01codespace marked this pull request as draft February 20, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant