Codemirror Custom mode support #1674

Open
opened 2026-02-05 01:34:03 +03:00 by OVERLORD · 13 comments
Owner

Originally created by @Naltaris on GitHub (Apr 21, 2020).

Codemirror supports adding new mode(s) (language syntax) but this is not leveraged here.

Because of javascript sources in this project are minimized it is not possible add new CodeMirror mode outside of full development where new branch for this needs to be kept.

Would it be possible to add support so that we can add new codemirror modes easily as a sort of "plugin"?

Originally created by @Naltaris on GitHub (Apr 21, 2020). Codemirror supports adding new mode(s) (language syntax) but this is not leveraged here. Because of javascript sources in this project are minimized it is not possible add new CodeMirror mode outside of full development where new branch for this needs to be kept. Would it be possible to add support so that we can add new codemirror modes easily as a sort of "plugin"?
Author
Owner

@ssddanbrown commented on GitHub (Apr 25, 2020):

Hi @Naltaris,

I could expose some kind of JavaScript hooks if really wished for but they'll only be semi-officially supported. To be honest, as long as the languages you want to add are fairly common i'd be happy to add them in to the core list anyway.

@ssddanbrown commented on GitHub (Apr 25, 2020): Hi @Naltaris, I could expose some kind of JavaScript hooks if really wished for but they'll only be semi-officially supported. To be honest, as long as the languages you want to add are fairly common i'd be happy to add them in to the core list anyway.
Author
Owner

@Naltaris commented on GitHub (Apr 30, 2020):

Hi @ssddanbrown ,

I would really appreciate the hooks.

Company I work for is using Proprietary languages so it is not possible to have them in official release :(

Thank you

@Naltaris commented on GitHub (Apr 30, 2020): Hi @ssddanbrown , I would really appreciate the hooks. Company I work for is using Proprietary languages so it is not possible to have them in official release :( Thank you
Author
Owner

@techauthoruk commented on GitHub (Aug 3, 2021):

HI Dan @ssddanbrown

Sorry to bump an old thread, but I was wondering whether .NET is in the core list? I see VBScript is, but using VB.NET (which is how it seems to be specified in the CodeMirror language modes page) doesn't appear to be enabled. I still have to document a lot of VB and .NET code in my work, so this would be very useful if you could enable it.

Thanks!

Mark

@techauthoruk commented on GitHub (Aug 3, 2021): HI Dan @ssddanbrown Sorry to bump an old thread, but I was wondering whether .NET is in the core list? I see VBScript is, but using VB.NET (which is how it seems to be specified in the CodeMirror language modes page) doesn't appear to be enabled. I still have to document a lot of VB and .NET code in my work, so this would be very useful if you could enable it. Thanks! Mark
Author
Owner

@ssddanbrown commented on GitHub (Aug 3, 2021):

Hi @techauthoruk,
Sorry, I'm not too familiar with the world of .net and VBscript, My understanding was that a lot of .net was c#. I see that VB.NET is something else within the .net landscape, Seems popular enough and supported officially by codemirror so feel free to open a new issue for that to be added to the default included options. Not currently included but could be sneaked into the next release quite easily.

@ssddanbrown commented on GitHub (Aug 3, 2021): Hi @techauthoruk, Sorry, I'm not too familiar with the world of .net and VBscript, My understanding was that a lot of .net was c#. I see that VB.NET is something else within the .net landscape, Seems popular enough and supported officially by codemirror so feel free to open a new issue for that to be added to the default included options. Not currently included but could be sneaked into the next release quite easily.
Author
Owner

@DomiQuentin commented on GitHub (Mar 11, 2022):

Hi, I same request, I was trying to add commonlisp https://codemirror.net/mode/commonlisp/index.html.

Could you expose or add the language please ?

Quentin

@DomiQuentin commented on GitHub (Mar 11, 2022): Hi, I same request, I was trying to add commonlisp https://codemirror.net/mode/commonlisp/index.html. Could you expose or add the language please ? Quentin
Author
Owner

@Mazvy commented on GitHub (Apr 8, 2022):

+1 for this feature.

Would love to add an Apache config mode that isn't bundled with codemirror https://github.com/gauthier-th/codemirror-mode-apache

If this is a non trivial thing to include as a base feature in BookStack (easily adding custom modes), perhaps we could get a basic instructional guide on how to do this manually? As it stands I'm confused how this would have to done.

Thanks!

@Mazvy commented on GitHub (Apr 8, 2022): +1 for this feature. Would love to add an Apache config mode that isn't bundled with codemirror https://github.com/gauthier-th/codemirror-mode-apache If this is a non trivial thing to include as a base feature in BookStack (easily adding custom modes), perhaps we could get a basic instructional guide on how to do this manually? As it stands I'm confused how this would have to done. Thanks!
Author
Owner

@ssddanbrown commented on GitHub (May 30, 2022):

Very closely related to #844

@ssddanbrown commented on GitHub (May 30, 2022): Very closely related to #844
Author
Owner

@momomsr commented on GitHub (Nov 28, 2022):

I also support this feature.

Is there any work beeing done on this topic? We need to have Structured Text, one of the IEC 61131-3 Standardized languages, to be integrated within codemirror. unfortunately it is not part of the official package or offically registered as community-mode on the codemirror-project.
Is there a possibility to integrate it ourselfes (we have a IT-company maintaining our bookstack-app, i would ask them to do so) or would be risk not to be able to update in the future (or similar)?

I love to use bookstack, thanks for the good work, i highly appreciate!
Thank you!

@momomsr commented on GitHub (Nov 28, 2022): I also support this feature. Is there any work beeing done on this topic? We need to have Structured Text, one of the IEC 61131-3 Standardized languages, to be integrated within codemirror. unfortunately it is not part of the official package or offically registered as community-mode on the codemirror-project. Is there a possibility to integrate it ourselfes (we have a IT-company maintaining our bookstack-app, i would ask them to do so) or would be risk not to be able to update in the future (or similar)? I love to use bookstack, thanks for the good work, i highly appreciate! Thank you!
Author
Owner

@carlossierra311 commented on GitHub (Jan 13, 2023):

@ssddanbrown, do you have plans to include this in a near version? Thanks

@carlossierra311 commented on GitHub (Jan 13, 2023): @ssddanbrown, do you have plans to include this in a near version? Thanks
Author
Owner

@ssddanbrown commented on GitHub (Jan 13, 2023):

@carlossierra311 Probably not too soon to be honest. Could have added sooner via a hacky way but wanted to think about doings things a bit nicer. #3904 would work towards that. Also need to think about the move away from CodeMirror 5 since that would affect things here, hence no point moving this forward beforehand really.

@ssddanbrown commented on GitHub (Jan 13, 2023): @carlossierra311 Probably not too soon to be honest. Could have added sooner via a hacky way but wanted to think about doings things a bit nicer. #3904 would work towards that. Also need to think about the move away from CodeMirror 5 since that would affect things here, hence no point moving this forward beforehand really.
Author
Owner

@carlossierra311 commented on GitHub (Jan 13, 2023):

Too bad. Thanks anyway.

@carlossierra311 commented on GitHub (Jan 13, 2023): Too bad. Thanks anyway.
Author
Owner

@momomsr commented on GitHub (Jan 17, 2023):

Thanks for the honest answer. If there would be any workaround to get it working with a custom language please let us know.
Thanks for the great work in general!

@momomsr commented on GitHub (Jan 17, 2023): Thanks for the honest answer. If there would be any workaround to get it working with a custom language please let us know. Thanks for the great work in general!
Author
Owner

@lexi-the-cute commented on GitHub (Oct 23, 2024):

I'd really love the ability to add custom languages on the fly, especially since CodeMirror doesn't add new languages anymore. I'm looking to add the ability to highlight AVR Assembly (based on RISC). While I found AVR Asm syntax highlighting for highlight.js, however, I could not find it for CodeMirror.

@lexi-the-cute commented on GitHub (Oct 23, 2024): I'd really love the ability to add custom languages on the fly, especially since [CodeMirror doesn't add new languages anymore](https://github.com/codemirror/codemirror5/pull/4428#issuecomment-266375003). I'm looking to add the ability to highlight AVR Assembly (based on RISC). While I found [AVR Asm syntax highlighting for highlight.js](https://github.com/highlightjs/highlight.js/blob/main/src/languages/avrasm.js), however, I could not find it for CodeMirror.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1674