-
Notifications
You must be signed in to change notification settings - Fork 91
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
feat: Add support for mermaid.js rendering #4614
Conversation
2 flaky tests on run #11528 ↗︎
Details:
nodes/FrontMatter.spec.js • 1 flaky test
api/SyncServiceProvider.spec.js • 1 flaky test
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
@nextcloud/designers Do you have any suggestions to make the UI a bit nicer here? |
2da2c63
to
5317b4e
Compare
5317b4e
to
2c6483e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice! Some enhancements for the diagram style:
- It is purple now, could instead use the primary color: primary-light for bg, primary for the border
- The text in the boxes doesn’t look vertically aligned but a bit too far up / too much bottom padding
- Boxes could use border-radius (3px default), might look nicer and Nextcloud-y
- The Yes/No boxes in the example could use some more padding
- If it makes sense, the Yes/No text can also be bold? Or is the other stuff more important? (Either way maybe makes sense to bold one of the types)
Super cool! :) 🎉 It looks great! Agreed with Jan's visual changes, and I'm also wondering if we can just change this to "Insert flowchart" as a separate formatting option and link to the mermaid language documentation for help with the syntax? so not have it as a part of the code block option. It can insert an example flowchart so people have something to start with. What do you think? :) |
I'll see how far we can influence the diagram rendering, but this might be more complex if we need to provide a custom theme: https://mermaid.js.org/config/theming.html Would you consider this a blocker or just nice to have?
Mermaid supports all kinds of charts, but we could add a separate option "Insert diagram" with #4587 though I'd keep this as a follow up then. For the syntax documentation that seems like a nice suggestion. |
That works! Adding a separate option would be great to increase visibility for such a cool feature. |
Theming is more complex as we'd need to set matching colors for all possible diagram formats and ideally also adapt them to the theme color from Nextcloud, so nothing we can easily achieve within the planned timeline. |
Looks really nice and I'm looking forward to use this myself 😊 Regarding the menu icon, I wonder whether it would be better to have a static one to avoid confusion and mark the selected view (Source code, Both or Diagram) as highlighted in the menu. Personally I find it confusing that clicking on an eye icon allows me to change to source code view and the other way round. We could use the Pencil icon (that we use for editing buttons) to open the menu, what do you think? |
The edit button seems more fitting indeed, but would probably not fit to indicate switching from edit to diagram view or in the regular code block to change the language. Will think a bit about that, further input still welcome of course :) |
My suggestion would be:
|
fff7d2d
to
1a2d594
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor comments, otherwise looks good 😊
I wonder whether we should backport the setEditable()
and defaultLanguage: 'plaintext'
fixes to stable26 and stable27.
1a2d594
to
a1b7116
Compare
Signed-off-by: Julius Härtl <[email protected]>
Signed-off-by: Julius Härtl <[email protected]>
Signed-off-by: Julius Härtl <[email protected]>
Signed-off-by: Julius Härtl <[email protected]>
a1b7116
to
946ca9b
Compare
/compile |
Signed-off-by: nextcloud-command <[email protected]>
/backport b9ea43f,62f5d3e846b604a9e7576f5b9eae85bdd82fba1f,6a8b01fa57d9ba253607257262d8c56cd7ee21ec,946ca9bcba925b9bca8809538a069d67c2303d73 to stable27 |
The backport to stable27 failed. Please do this backport manually. # Switch to the target branch and update it
git checkout stable27
git pull origin stable27
# Create the new backport branch
git checkout -b fix/foo-stable27
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123
# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable27 More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport |
📝 Summary
Fixes #163
Implements mermaid js support for code blocks. By default the preview mode is used, unless the code block is empty or has faulty syntax. Users can then switch between preview/split and code mode. This also provides a way to switch the language of code blocks in the same location.
🖼️ Screenshots
Mermaid code block
Regular code bock
🚧 TODO
Follow up tickets
🏁 Checklist
npm run lint
/npm run stylelint
/composer run cs:check
)