Skip to content

Add LaTex Support#7957

Merged
juliusknorr merged 5 commits intonextcloud:mainfrom
moodyjmz:feat/latex-math-clean
Nov 19, 2025
Merged

Add LaTex Support#7957
juliusknorr merged 5 commits intonextcloud:mainfrom
moodyjmz:feat/latex-math-clean

Conversation

@moodyjmz
Copy link
Copy Markdown
Contributor

@moodyjmz moodyjmz commented Nov 18, 2025

📝 Summary

This PR adds LaTeX math support to the text app.

it uses:

  • Inline typing $…$
  • Block typing $$…$$
  • Pasting of inline
  • Pasting of blocks
  • Editing of both - I did consider using the same approach as inline links, the bubble, but decided to use the modal approach for both
  • I added a feature into the menu to change existing content into maths - under the markup section

Code:

  • I used a factory for making math nodes to avoid duplicating code
  • It adds a modal, following the pattern of Image

Tests:
It adds some tests covering the features added, and issues I encountered while adding the feature

Limitations:

The existing modal doesn’t appear to be resizable - therefore here is set to largest

🖼️ Screenshots

🏚️ Before 🏡 After
image image
image image
image image

🚧 TODO

  • ...

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation (README or documentation) has been updated or is not required

@moodyjmz moodyjmz marked this pull request as draft November 18, 2025 15:12
@moodyjmz
Copy link
Copy Markdown
Contributor Author

I wanted to see if it would push the expected files - not ready for review yet

Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>

feat(:tada:): Make clean branch to avoid pollution from build files in project

feat(:wrench:): Update package-lock to be inline with main

feat(:wrench:): Update package-lock to be inline with main
@moodyjmz moodyjmz force-pushed the feat/latex-math-clean branch from 9eaa0ee to 533af02 Compare November 18, 2025 16:50
@moodyjmz moodyjmz marked this pull request as ready for review November 18, 2025 16:54
@moodyjmz
Copy link
Copy Markdown
Contributor Author

@max-nextcloud Sorry about the confusion, hopefully this PR is better to check. It only has one commit as I took the files from the other branch.

@juliusknorr juliusknorr added enhancement New feature or request 3. to review labels Nov 18, 2025
@juliusknorr juliusknorr self-requested a review November 18, 2025 19:33

Nextcloud Text is the default text editor since Nextcloud 17. To start editing just open an existing markdown or plaintext file or create a new one.

### Mathematical formulas
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far we do not really have much end user documentation. I'd say we could keep it in here for now still. We probably want this to go to docs.nextcloud.com but just the math section might not be that useful.

@max-nextcloud @mejo- Something we could discuss further as you were thinking about enhancing documentation for collectives, but there may be some overlap with what we could make use of for text itself.

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 58.65385% with 43 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/nodes/MathematicsView.vue 3.84% 20 Missing and 5 partials ⚠️
src/nodes/Mathematics.js 82.35% 11 Missing and 1 partial ⚠️
src/components/Math/ShowMathModal.vue 20.00% 4 Missing ⚠️
src/components/Menu/entries.js 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, I left one inline comment and there are two CI checks that need some more work to pass.

When testing the modal seems to have an issue with not taking up the full height of the textarea, but I'm unsure if that is a component issue or could be addressed here as well. Would be fine to track as a follow up for polishing:

Screenshot 2025-11-18 at 20 54 36

@juliusknorr
Copy link
Copy Markdown
Member

Also cc @marcoambrosini for a design review

Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
…thing and not removed

Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
@moodyjmz moodyjmz force-pushed the feat/latex-math-clean branch from 0d8e038 to 8d381b5 Compare November 18, 2025 19:59
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
@moodyjmz
Copy link
Copy Markdown
Contributor Author

Very nice, I left one inline comment and there are two CI checks that need some more work to pass.

When testing the modal seems to have an issue with not taking up the full height of the textarea, but I'm unsure if that is a component issue or could be addressed here as well. Would be fine to track as a follow up for polishing:

Screenshot 2025-11-18 at 20 54 36

Thanks :)

I addressed those issues.

Yes, the modal, I was unsure what caused it, but felt it was out of scope to address in this PR.

@moodyjmz moodyjmz changed the title WIP: Add LaTex Support Add LaTex Support Nov 19, 2025
@juliusknorr juliusknorr merged commit 31af010 into nextcloud:main Nov 19, 2025
64 checks passed
@mejo-
Copy link
Copy Markdown
Member

mejo- commented Nov 24, 2025

@moodyjmz thanks a lot for the contribution, much appreciated ❤️

I just reviewed the PR (was on vacation last week) and realized that it adds @tiptap/extension-mathematics as NPM dependency but doesn't actually use it. I guess that it's a leftover from your development process? Also, looking at the upstream @tiptap/extension-mathematics code I wondered what was the reason why you decided to implement the whole mathematics node type yourself instead of using and extending the upstream @tiptap/extension-mathematics one 😊

@moodyjmz
Copy link
Copy Markdown
Contributor Author

@moodyjmz thanks a lot for the contribution, much appreciated ❤️

I just reviewed the PR (was on vacation last week) and realized that it adds @tiptap/extension-mathematics as NPM dependency but doesn't actually use it. I guess that it's a leftover from your development process? Also, looking at the upstream @tiptap/extension-mathematics code I wondered what was the reason why you decided to implement the whole mathematics node type yourself instead of using and extending the upstream @tiptap/extension-mathematics one 😊

@mejo- You are right about the npm dependency - that shouldn't be there. I looked at callouts.js for guidance and followed that. I'm not sure how many changes would be needed to use the tiptap approach, although that is likely a better implementation and reduces maintenance overhead. I can see, looking at other files, that tiptap extensions are extended from elsewhere.

@moodyjmz
Copy link
Copy Markdown
Contributor Author

@mejo- Removing the dependency is easy. However, I would say it should be used instead. However this also raises the question of backward compatibility - if this feature is implemented differently in terms of processing to/from markdown than what is already there - this needs to be determined. Based on that, then the amount of changes can be determined. Is this feature already in the in the wild?

@mejo-
Copy link
Copy Markdown
Member

mejo- commented Nov 24, 2025

@moodyjmz thanks a lot for considering my concerns. I agree that we should use the upstream Tiptap extension and expand on it in case we need extra functionality. The toMarkdown() functions need to be added for sure, and if we still want/need the custom NodeView representation, then the NodeView vue file as well.

I just opened #7977 to track follow-up topics for this PR. If you don't mind, we can move the conversation there.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 3, 2025

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Latex Math commands

3 participants