CodeMirror nginx-renewed mode

This is a CodeMirror mode that brings syntax highlighting for nginx configuration files.

Features:

MIME types defined:

Options:

MIME types used to invoke nested modes:

Direct use

By default, codemirror-mode-nginx-renewed:

  1. assumes the textarea reflects nginx's main scope (i.e. the same scope as nginx.conf);
  2. checks whether each directive is allowed in the current scope.
The textareas below showcase codemirror-mode-nginx-renewed's capabilities.

Useful commands:

This textarea is a copy of lua-nginx-module's synopsis:

Custom use without a specific scope

Sometimes, it is hard, if not impossible, to predict the scope of an nginx snippet. Typical cases:

To deal with these situations, state "check_directive_scope: false" when configuring codemirror-mode-nginx-renewed.

Custom use with specific scopes

By playing with the "initial_scope" setting, it is possible to change the nginx scope of the textarea. initial_scope defaults to "main" and can take various values reflecting the desired scope. Examples:

Other examples and demonstrations follow.

main/http/map

main/http/geo

main/http/types

main/http/server

main/http/server/location

main/http/upstream