Skip to content

Adding mutiple markdown-it plugins #2730

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

isZYKerman
Copy link

In #1006 I reported that Forms fails to resize pictures when they are rendered and @Chartman123 gave me a useful plugin @mdit/plugin-img-resize to solve this. I managed to add it into Forms. I also added other 4 plugins including @mdit/plugin-align, @mdit/plugin-mark, @mdit/plugin-sub and @mdit/plugin-sup which allow users to align or mark their text and add superscripts or subscripts.

Effects:
screencapture-localhost-30030-apps-forms-yK6BYFn2y5wYKeCD-edit-2025-05-09-00_43_36
screencapture-localhost-30030-apps-forms-yK6BYFn2y5wYKeCD-submit-2025-05-09-00_43_57

@Chartman123 Chartman123 requested review from susnux and Chartman123 May 8, 2025 23:03
@Chartman123 Chartman123 added enhancement New feature or request javascript Javascript related ticket 3. to review Waiting for reviews feature: 📑 form creation labels May 8, 2025
@Chartman123 Chartman123 added this to the 5.2 milestone May 8, 2025
Copy link
Collaborator

@Chartman123 Chartman123 left a comment

Choose a reason for hiding this comment

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

Thanks for your pull request :) I've added a few comments

package.json Outdated
@@ -54,6 +54,11 @@
"devDependencies": {
"@mdi/js": "^7.4.47",
"@mdi/svg": "^7.4.47",
"@mdit/plugin-align": "^0.18.0",
"@mdit/plugin-img-size": "^0.18.0",
"@mdit/plugin-mark": "^0.18.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if we should really include this one. For emphasizing some text you could already make it bold or italic.

Copy link
Author

Choose a reason for hiding this comment

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

🤔 I reckon that more functions are better... and at least when I tested it nothing went wrong.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@susnux what do you think about including the mark plugin?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We dismissed a similar PR in the past: #2201
I am not really sure we want to add additional non-commonmark and non-gh-flavor markdown.

This is different from what all other Nextcloud apps provide (Collectives, Text, Talk, Comments...).
IMHO best would be to support everything NcRichtext support (we could also just use it).

Copy link
Author

Choose a reason for hiding this comment

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

🤔so shall i remove this and re-submit the pr?

@Chartman123
Copy link
Collaborator

Please don't use merge commits. It's better to rebase your branch onto our current main :)

@isZYKerman
Copy link
Author

Sorry, I'm new to GitHub and is really unfamiliar with this :( What should I do now

isZYKerman added 2 commits May 9, 2025 21:00
…esizing, mark, superscript and subscript.

Signed-off-by: ZYKerman <[email protected]>
@Chartman123
Copy link
Collaborator

Chartman123 commented May 9, 2025

@isZYKerman no problem :) I see that you managed to rebase the changes and omit the merge commit 👍🏻 And don't get me wrong: we're really happy that you stepped up and help us with this contribution

Copy link
Collaborator

@susnux susnux left a comment

Choose a reason for hiding this comment

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

As mentioned in the comment I am not sure we want to add some "random" plugins making it hard to discover what kind of Markdown is supported.

Because this will make it different from e.g. Text, Collectives, Comments, Talk etc apps.
Probably the best is to just use NcRichtext like all of those (except text) are using. So the experience across Nextcloud apps is similar.

@Chartman123
Copy link
Collaborator

As mentioned in the comment I am not sure we want to add some "random" plugins making it hard to discover what kind of Markdown is supported.

Because this will make it different from e.g. Text, Collectives, Comments, Talk etc apps. Probably the best is to just use NcRichtext like all of those (except text) are using. So the experience across Nextcloud apps is similar.

Yes, a component from our vue lib should be preferred, but there's also no way of setting the image size which could be a real problem, if want to further promote the ability to include images into descriptions

@susnux
Copy link
Collaborator

susnux commented May 12, 2025

but there's also no way of setting the image size which could be a real problem, if want to further promote the ability to include images into descriptions

Maybe we could make them max-width something meaning full as a preview and on click use the viewer to show it as full width?

@isZYKerman
Copy link
Author

Most markdown renderers I've ever used (e.g. GitHub) automatically adapt the size of pictures to that of webpages. Just type ![img](/source) and the renderer will deal with the size itself. It would be great if we achieve this. The @mdit/plugin-img-size can only resize pictures to a certain size —— xx px* yy px and thus it is not so friendly to mobile users (but it is still better than the current status in which pictures are displayed in full size and ruin the whole page).

@isZYKerman
Copy link
Author

isZYKerman commented May 16, 2025

So....... What is out final solution? @Chartman123 @susnux

Copy link

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
Labels
3. to review Waiting for reviews enhancement New feature or request feature: 📑 form creation feedback-requested javascript Javascript related ticket
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants