Jump to content

Topic on Extension talk:CodeMirror

Plantaest (talkcontribs)

How to use this syntax highlighter's API on some userscript or out of MediaWiki?

Thiemo Kreuz (WMDE) (talkcontribs)

There is not really an official API, as far as I'm aware of. What you can do is to re-use the original CodeMirror library the same way the extension does. In a user script this would probably be done via mw.loader.using( [ 'ext.CodeMirror.lib' ] ).then( … ) and then something like CodeMirror.fromTextArea( … ). See ResourceLoader/Developing with ResourceLoader as well as ext.CodeMirror.js for more information.

Plantaest (talkcontribs)

Thanks. I understood.

This syntax highlighter for wikitext is really good. It should be added into CodeMirror docs: https://codemirror.net/5/mode/index.html for other uses out of MediaWiki scope.

I didn't find much syntax highlighter for wikitext on Internet.

Reply to "API"