CodeMirror IP addresses (ipaddr) mode

This is a CodeMirror mode that brings syntax highlighting for IP addresses.

MIME types defined

Supported formats

IPv6 IPv4
Addresses
CIDR
Ranges
Dual addresses

Options:

All options above default to true.

Strict mode

If strict mode is enabled, only one value (address, range or CIDR) will be parsed; everything else will be marked as erroneous. Example with an IP range: If strict mode is disabled, codemirror-mode-ipaddr parses and highlights all IP addresses in the text editor:

Various tests

IPv4-only textarea

IPv6-only textarea

IPv4+IPv6 textarea: