How do I enable syntax highlighting?
-
Hello,
Sorry for the silly question, I’m trying to enable syntax highlighting for a textarea_code field and I can’t find any resource to do so. My component is configured in js mode but there’s no formatting nor linting whatsoever.Actually I’m not even sure CMB2 currently supports syntax highlighting despite using the native wordpress codemirror component – Do I really need to use a third party plugin like https://github.com/timothyjensen/cmb2-syntax-highlighting ?
I’m setting my component like this:
$cmbSceneFields->add_field( array( 'name' => __('Script', 'visual-js'), 'desc' => __('Add your scripts directly here. Only ES5 Javascript is supported at the moment.', 'visual-js'), 'id' => '_js_editor', 'type' => 'textarea_code', 'default' => "\nfunction foo() {}", 'sanitization_cb' => 'checkScriptValueContent', 'attributes' => array( 'data-codeeditor' => json_encode( array( 'codemirror' => array( 'mode' => 'js' ), )), ), ) );
Thanks.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How do I enable syntax highlighting?’ is closed to new replies.