Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

How to configure the mode option of a CodeMirror widget for C++? #24

Open
GoBigorGoHome opened this issue Aug 1, 2017 · 0 comments
Open

Comments

@GoBigorGoHome
Copy link

GoBigorGoHome commented Aug 1, 2017

As the language modes page shows, for the C++ language CodeMirror only has a C-like mode, and it seems that to make a proper configuration for C++, we have to

  1. set the name of the mode to 'clike' to load the appropriate mode file (clike.js in this case), and
  2. set the MIME type to text/x-c++src, as suggested at the bottom of this page, since the clike mode is not C++-specific.

And how can I achieve that without hard-coding something into the template file?

For reference, the CodeMirror manual says

mode: string|object
The mode to use. It may be a string, which either simply names the mode or is a MIME type associated with the mode. Alternatively, it may be an object containing configuration options for the mode, with a name property that names the mode (for example {name: "javascript", json: true})

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant