Wrap fenced code blocks on-demand#1668
Conversation
…ature-code-wrap-button
There was a problem hiding this comment.
Thanks for working on this @riyadh-h. The implementation looks good 👍
In case the first line of the code block is long, the button will appear overlaid on the code like so
Yup agree that the positioning of the buttons should be shifted. I'm fine with the suggested design.
One more thing I would like to add:
What do you think about having word-break as well? Although we currently do not have any issues in our docs, there may be instances of users having a long single word (function names, tags etc).

|
No problem, and thank you for the feedback, @jonahtanjz! 😄
Alright, I'll try implementing that design with some modifications to give it a better look 👍.
I agree, because in such cases the wrapping feature would be of no use. |
jonahtanjz
left a comment
There was a problem hiding this comment.
Thanks for making the changes :)
LGTM 👍
What is the purpose of this pull request?
Resolves #1289
Overview of changes:
Anything you'd like to highlight / discuss:
Modifications were made for
markbind.css; thus, frontend bundles should be updated for the best results.In case the first line of the code block is long, the button will appear overlaid on the code like so:

Feel free to suggest more designs.
EDIT: A design similar to the example above was implemented:
Testing instructions:
Since there doesn't seem to be any automated tests for the basis of this feature (i.e., the "copy" code block plugin), this feature also does not have such tests. If there are automated tests for the "copy" code block button that I might have missed, please let me know; otherwise, feel free to ask me to write automated tests for both plugins.
With that said, here are some steps to test this feature manually:
codeBlockWrapButtonsto thepluginsarray in the root'ssite.json.site.jsondoes not have apluginsattribute, copy and paste the following before the last closing curly brace at the end of the file:This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long line of code.markbind serve -d.codeBlockCopyButtonsandcodeBlockWrapButtonsplugins or using the "wrap text" button with code block consisting of short lines.Proposed commit message: (wrap lines at 72 characters)
Checklist: ☑️
codeBlockCopyButtoncode were made in order to allow for the implementation of more buttons with different functions.