-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Feature Request]: Code block line wrap support #3272
Comments
I think this would be a really good addition if it is possible within the current framework |
+1 for this feature |
I need this too |
This script in the head makes it work:
Don't thank me... Thank Open AI ;) |
This is not working anymore, it seems. |
Seems like a good feature. Some code is just so long and goes off-screen making it harder to read the code. |
Within #4639 I've exposed the newer CodeMirror (code block) instances to allow a route of customization/hacking. <script>
window.addEventListener('library-cm6::pre-init', event => {
const detail = event.detail;
const config = detail.editorViewConfig;
const EditorView = detail.libEditorView;
if (detail.usage === 'content-code-block') {
config.extensions.push(EditorView.lineWrapping);
}
});
</script> |
thank you, this works great! (tested with v23.12), highly appreciated! |
Is there a way to wrap conditionally based on language? For instance I only want to wrap the text if no language syntax is specified, but if we specify any code language (bash, php, C, js, etc) I dont want text wrapping. I couldn't find any language item in the event data list. So I thought I'd ask in case i missed it. |
Describe the feature you'd like
I would like to have the ability to make a 'block code' format but without horizontal scrollbars.
Basically word wrapping that is used in many text editors.
The line-numbering should be empty on lines that are wrapped.
Describe the benefits this feature would bring to BookStack users
This makes the ease of use much higher for readers to view the entire code in one go without having to manually scroll horizontally to view every part of the code/text.
Additional context
Example of word-wrapping in another program:
The text was updated successfully, but these errors were encountered: