BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
15.18k stars 1.9k forks source link

Codemirror Custom mode support #2057

Open Naltaris opened 4 years ago

Naltaris commented 4 years ago

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"?

ssddanbrown commented 4 years ago

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.

Naltaris commented 4 years ago

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

techauthoruk commented 3 years ago

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

ssddanbrown commented 3 years ago

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.

DomiQuentin commented 2 years ago

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

Mazvy commented 2 years ago

+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!

ssddanbrown commented 2 years ago

Very closely related to #844

momomsr commented 1 year ago

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!

carlossierra311 commented 1 year ago

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

ssddanbrown commented 1 year ago

@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.

carlossierra311 commented 1 year ago

Too bad. Thanks anyway.

momomsr commented 1 year ago

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!

lexi-the-cute commented 3 hours ago

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.