CodeMirror nginx renewed mode
This is a CodeMirror mode that provides syntax highlighting for nginx configuration files.
The "renewed" suffix is used to distinguish this mode from CodeMirror's original nginx mode.
The latter is basically a quick and dirty fork of the CSS mode adjusted for nginx.
On the other hand, the nginx renewed mode was written from scratch with the intent of highlighting as many nginx directives as possible, but also various other things: regular expressions, variables in strings, IP addresses, MIME types, Lua blocks.
The nginx renewed mode also marks nginx directives as erroneous if they appear in the wrong scope (e.g. proxy_pass
directly in an http
/server
block) -- if needed, this marking can be disabled.
Refer to the demo page for a complete list of features, MIME types and options.
How to use
Basic use
Load nginx-renewed.js
at an adequate location in your HTML structure.
Mention mode: 'nginx-renewed'
when creating your CodeMirror instance or, better, mode: 'text/x-nginx-conf'
.
Theming
This mode leverages CodeMirror's default tokens and should therefore fit in with all CodeMirror themes. However, it optionally relies on codemirror-mode-pcre, which does NOT use these default tokens. Consequently, CSS adjustments may be required for regular expressions to look good.
Limitations
Sizes (e.g. "8k"), durations (e.g. "1h30m") and other numbers are not spotted as such and remain highlighted as regular strings.
License
This mode is released under the 3-clause BSD license.
Commit History @master
- Tag v1.0.1. Xavier G 3 years ago
- Fix access to mode options. Xavier G 3 years ago
- Add npm's package.json. Xavier G 3 years ago
- nginx directives: adjust URL in extract_directives.bash. Xavier G 3 years ago
- Handle comments. Xavier G 3 years ago
- Demo page: upgrade to CodeMirror 5.62.2. Xavier G 3 years ago
- Handle indentation. Xavier G 3 years ago
- Fix a bug in copyState(). Xavier G 3 years ago
- Improve handling of nested locations. Xavier G 3 years ago
- Add README file. Xavier G 3 years ago