Skip to content

feat: enhance math rendering and copy functionality in chat#41

Merged
chenyme merged 2 commits into
devfrom
enhance_latex
May 24, 2026
Merged

feat: enhance math rendering and copy functionality in chat#41
chenyme merged 2 commits into
devfrom
enhance_latex

Conversation

@chenyme

@chenyme chenyme commented May 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix Markdown math rendering in chat messages and improve formula readability/interaction. The update makes Streamdown math rendering more robust for \(...\) / \[...\], table cells containing LaTeX absolute-value pipes such as |x|, and inline math split across lines. It also initializes the math plugin eagerly to avoid refresh-time render misses, adds formula source copy support, applies consistent KaTeX typography, and tightens spacing around rendered dividers/headings.

Change type

  • Bug fix
  • Feature
  • Documentation
  • Refactor
  • Configuration / deployment
  • Security hardening
  • Other

Affected areas

  • Frontend / UI
  • Backend / API
  • Authentication / authorization
  • Conversations / streaming
  • Files / RAG / extraction
  • Model routing / providers
  • MCP / tools
  • Billing / payments
  • Admin console
  • Deployment / Docker / configuration
  • Documentation

Verification

  • pnpm --dir frontend lint
  • pnpm --dir frontend exec tsc --noEmit
  • git diff --check

Screenshots, API examples, or logs

Tested with Markdown table examples containing LaTeX formulas such as \ln(1+x) and |x| < 1. The formulas now render through KaTeX instead of being split by Markdown table parsing.

Configuration, migration, and compatibility notes

Configuration changes: None.

API changes: None.

Database migrations: None.

Deployment changes: None.

Backward compatibility: Existing conversation content remains unchanged; rendering is improved at the frontend Markdown layer.

Documentation

  • Documentation is not needed for this change.
  • Documentation was updated.
  • Documentation still needs to be updated.

Security and privacy

  • No secrets, tokens, credentials, local config, or personal data are included.
  • User data access remains scoped by authenticated user context unless an admin-only path explicitly requires broader access.
  • Security-sensitive behavior was reviewed, including authentication, authorization, provider routing, file processing, billing, and admin APIs where relevant.

Checklist

  • I searched existing issues and pull requests.
  • Changes are focused and do not include unrelated refactors.
  • Tests or static verification were run where practical.
  • User-facing behavior, deployment steps, API contracts, or configuration changes are documented.
  • Generated artifacts are included only when this project explicitly requires them.
  • Caches, build output, .pyc files, .env files, and local storage data are not committed.

@chenyme chenyme linked an issue May 24, 2026 that may be closed by this pull request
3 tasks
@chenyme
chenyme merged commit c13cd43 into dev May 24, 2026
2 checks passed
@chenyme
chenyme deleted the enhance_latex branch May 24, 2026 07:59
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.

[Feature]: 优化数学公式渲染并支持复制 LaTeX 源码

1 participant