ABAP mode for the CodeMirror editor
Add ABAP syntax highlighting to the CodeMirror editor.
npm install --save codemirror-abap
-
Import
codemirror-abap
in your project.import CodeMirror from 'codemirror'; // mode and MIME type are registered automatically import 'codemirror-abap';
or
import CodeMirror from 'codemirror'; import { abapMode } from 'codemirror-abap'; // explicitly register mode CodeMirror.defineMode("abap", abapMode);
-
Set 'abap' as the mode when instantiating the CodeMirror editor.
CodeMirror.fromTextArea(element, { mode: 'abap' });
-
Include the
codemirror-abap
bundle in a script tag.<!-- CodeMirror is a peer dependency --> <script src="js/codemirror.js"></script> <!-- mode and MIME type are registered automatically --> <script src="js/codemirror-abap/bundles/abap.min.js"></script>
or
<script src="js/codemirror.js"></script> <script src="js/codemirror-abap/bundles/abap.min.js"></script> <!-- explicitly register mode --> CodeMirror.defineMode("abap", abap.abapMode);
-
Set 'abap' as the mode when instantiating the CodeMirror editor.
CodeMirror.fromTextArea(element, { mode: 'abap' });
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.57.0/codemirror.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror-abap/bundles/abap.min.js"></script>
There's a simple React demo using react-codemirror2 in the demo directory of the git repo. To run the demo:
git clone https://github.com/larshp/codemirror-abap.git
cd codemirror-abap/demo
npm install
npm start