Have ideas to improve npm?Join in the discussion! »

    ldt

    1.0.3 • Public • Published

    A fork of Lightweight Decorator for Textareas. Demo.

    LDT aims to provide a simple, lightweight, and highly extensible alternative to existing in-browser live syntax highlighting solutions by leveraging clever CSS and native functionality.

    npm install ldt

    var Decorator = require('ldt');
     
    var ldt = Decorator(textarea, {
        whitespace: /\s+/,
        comment: /\/\/[^\r\n]*/,
        other: /\S+/
    });
    .ldt .comment { color: silver; }
    .ldt .string { color: green; }
    .ldt .number { color: navy; }
    .ldt .keyword { font-weight: bold; display: inline-block; margin-bottom: -1px; }
    .ldt .variable { color: cyan; }
    .ldt .define { color: blue; }

    Fork changes

    • highlighter is now placed over textarea, keeping it untouched
    • ES6
    • npm-package structure
    • removed keybinder and selection helper
    • tabs handling
    • styles issues
    • simplified API

    Install

    npm i ldt

    DownloadsWeekly Downloads

    5

    Version

    1.0.3

    License

    MIT

    Last publish

    Collaborators

    • avatar
    • avatar