Code Monkey home page Code Monkey logo

codemirror-mode-ipaddr's Introduction

CodeMirror IP addresses (ipaddr) mode

This is a CodeMirror mode that provides syntax highlighting for IP addresses. It supports regular addresses, CIDR notations and ranges for both IPv4 and IPv6. Dual addresses are also supported.

How to use

Basic use

Load ipaddr.js at an adequate location in your HTML structure. Mention mode: 'ipaddr' when creating your CodeMirror instance or, better, mode: 'text/x-ip-address'.

Configuration

Whether or not to recognize CIDR notations and IP ranges can be set using the following boolean options: ipv4_cidr, ipv6_cidr, ipv4_ranges, ipv6_ranges. By default, codemirror-mode-ipaddr highlights only the first part of the first line and marks everything else as erroneous. This is called strict mode and it can be disabled through strict: false. Refer to the demo page for further explanations.

Theming

This mode leverages CodeMirror's default tokens (number, punctuation, meta, attribute and error) and should therefore fit in with all CodeMirror themes.

Nesting

codemirror-mode-ipaddr was designed to be nested within another mode, i.e. to highlight IP addresses for another mode (of course, this requires adjusting the other mode). This is why strict mode is enabled by default. It may also be used to highlight IP addresses in single-line CodeMirror input fields.

License

This mode is released under the 3-clause BSD license.

codemirror-mode-ipaddr's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.