npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

witspry-ng-html-editor

v1.1.1

Published

A simple HTML editor component for Angular with syntax highlighting, line numbers, and auto-indentation

Readme

Angular HTML Editor

A simple, lightweight HTML editor component for Angular 19+ with syntax highlighting, line numbers, and auto-indentation features.

Features

  • HTML Syntax Highlighting - Real-time syntax highlighting for HTML tags, attributes, and content
  • Line Numbers - Optional line numbers with synchronized scrolling
  • Auto-indentation - Smart indentation based on HTML structure
  • Multiple Themes - Built-in Default, Light, and Dark themes
  • Configurable - Customizable tab size, font size, and editor behavior
  • NgModel Support - Full two-way data binding with Angular forms
  • Standalone Component - No additional dependencies required
  • TypeScript - Full TypeScript support with type definitions
  • Responsive - Mobile-friendly design
  • Accessibility - WCAG compliant with keyboard navigation support

Installation

npm install witspry-ng-html-editor

Usage

Basic Usage

import { Component } from '@angular/core';
import { HtmlEditorComponent } from 'witspry-ng-html-editor';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [HtmlEditorComponent],
  template: `
    <witspry-html-editor
      [(ngModel)]="htmlContent"
      placeholder="Enter HTML content...">
    </witspry-html-editor>
  `
})
export class ExampleComponent {
  htmlContent = '<div>Hello World</div>';
}

Advanced Usage

import { Component } from '@angular/core';
import { HtmlEditorComponent, EditorConfig, ThemeType } from 'witspry-ng-html-editor';

@Component({
  selector: 'app-advanced',
  standalone: true,
  imports: [HtmlEditorComponent],
  template: `
    <witspry-html-editor
      [(ngModel)]="htmlContent"
      [theme]="currentTheme"
      [config]="editorConfig"
      [readonly]="false"
      placeholder="Enter HTML content..."
      (contentChange)="onContentChange($event)"
      (focus)="onEditorFocus()"
      (blur)="onEditorBlur()">
    </witspry-html-editor>
  `
})
export class AdvancedComponent {
  htmlContent = `<div class="container">
  <h1>Welcome</h1>
  <p>This is a sample HTML content.</p>
</div>`;

  currentTheme: ThemeType = 'dark';
  
  editorConfig: EditorConfig = {
    tabSize: 2,
    autoIndent: true,
    lineNumbers: true,
    wordWrap: false,
    fontSize: '14px'
  };

  onContentChange(content: string): void {
    console.log('Content changed:', content);
  }

  onEditorFocus(): void {
    console.log('Editor focused');
  }

  onEditorBlur(): void {
    console.log('Editor blurred');
  }
}

API Reference

Component Inputs

| Property | Type | Default | Description | |----------|------|---------|-------------| | config | EditorConfig | defaultConfig | Editor configuration options | | theme | ThemeType | 'default' | Editor theme ('default' | 'light' | 'dark') | | readonly | boolean | false | Whether the editor is read-only | | placeholder | string | 'Enter HTML content...' | Placeholder text |

Component Outputs

| Event | Type | Description | |-------|------|-------------| | contentChange | EventEmitter<string> | Emitted when content changes | | focus | EventEmitter<void> | Emitted when editor gains focus | | blur | EventEmitter<void> | Emitted when editor loses focus |

EditorConfig Interface

interface EditorConfig {
  tabSize: number;        // Number of spaces for tab (2, 4, or 8)
  autoIndent: boolean;    // Enable auto-indentation
  lineNumbers: boolean;   // Show line numbers
  wordWrap: boolean;      // Enable word wrapping
  fontSize: string;       // Font size (e.g., '14px', '16px')
}

Theme Types

type ThemeType = 'default' | 'light' | 'dark';

Styling

The component uses CSS custom properties for theming. You can customize the appearance by overriding these variables:

witspry-html-editor {
  --editor-bg: #ffffff;
  --editor-text: #333333;
  --editor-border: #d1d5db;
  --editor-line-number-bg: #f9fafb;
  --editor-line-number-text: #6b7280;
  --editor-selection: #3b82f6;
  --editor-tag: #dc2626;
  --editor-attribute: #059669;
  --editor-string: #7c3aed;
  --editor-comment: #6b7280;
  --editor-text-content: #374151;
}

Form Integration

The component implements ControlValueAccessor and works seamlessly with Angular forms:

Template-driven Forms

import { FormsModule } from '@angular/forms';

@Component({
  imports: [FormsModule, HtmlEditorComponent],
  template: `
    <form #form="ngForm">
      <witspry-html-editor
        name="htmlContent"
        [(ngModel)]="htmlContent"
        required>
      </witspry-html-editor>
    </form>
  `
})
export class FormComponent {
  htmlContent = '';
}

Reactive Forms

import { ReactiveFormsModule, FormBuilder, FormGroup, Validators } from '@angular/forms';

@Component({
  imports: [ReactiveFormsModule, HtmlEditorComponent],
  template: `
    <form [formGroup]="form">
      <witspry-html-editor
        formControlName="htmlContent">
      </witspry-html-editor>
    </form>
  `
})
export class ReactiveFormComponent {
  form: FormGroup;

  constructor(private fb: FormBuilder) {
    this.form = this.fb.group({
      htmlContent: ['<div>Initial content</div>', Validators.required]
    });
  }
}

Browser Support

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see the LICENSE file for details.

Changelog

1.0.0

  • Initial release
  • HTML syntax highlighting
  • Line numbers support
  • Auto-indentation
  • Multiple themes
  • NgModel integration
  • Standalone component architecture

1.0.2

  • Syntax highlighting fixes and improvements

1.1.0

  • Added height as an input parameter.
  • Added scrolling if content is larger than height given in input parameter

1.1.1

  • Fixed word wrap and line number issues