@editora/light-code-editor
Advanced tools
| /** | ||
| * Lightweight multi-language formatter utilities. | ||
| * | ||
| * These helpers are intentionally conservative. They provide safe whitespace | ||
| * cleanup and simple indentation without pretending to replace full language | ||
| * formatters such as Prettier, Black, gofmt, php-cs-fixer, or rustfmt. | ||
| */ | ||
| import type { Formatter } from '../types'; | ||
| export type LightweightFormattingLanguage = 'html' | 'css' | 'markdown' | 'php' | 'python' | 'bash' | 'javascript' | 'go' | 'cpp' | 'java' | 'csharp' | 'rust' | 'ruby' | 'sql' | 'dockerfile' | 'vue' | 'ejs' | 'jsx' | 'xml' | 'plain'; | ||
| export declare function createLightweightFormatter(): Formatter; | ||
| export declare const lightweightFormatter: Formatter; | ||
| export declare function formatLightweightCode(input: string): string; | ||
| export declare function detectLightweightFormattingLanguage(input: string): LightweightFormattingLanguage; | ||
| export declare function formatCss(input: string): string; | ||
| export declare function normalizePlainCode(input: string): string; | ||
| //# sourceMappingURL=LightweightFormatter.d.ts.map |
@@ -18,2 +18,4 @@ /** | ||
| export type { FormattingExtensionConfig } from './FormattingExtension'; | ||
| export { createLightweightFormatter, detectLightweightFormattingLanguage, formatCss, formatLightweightCode, lightweightFormatter, normalizePlainCode, } from './LightweightFormatter'; | ||
| export type { LightweightFormattingLanguage } from './LightweightFormatter'; | ||
| export { ContextMenuExtension } from './ContextMenuExtension'; | ||
@@ -20,0 +22,0 @@ export type { ContextMenuExtensionConfig, ContextMenuItem, ContextMenuCommandItem, ContextMenuActionItem, ContextMenuSeparatorItem, } from './ContextMenuExtension'; |
@@ -44,2 +44,4 @@ /** | ||
| private _highlightXML; | ||
| private _highlightJSX; | ||
| private _highlightEJS; | ||
| private _highlightDockerfile; | ||
@@ -46,0 +48,0 @@ private _highlightJS; |
+1
-1
| { | ||
| "name": "@editora/light-code-editor", | ||
| "version": "1.0.9", | ||
| "version": "1.0.10", | ||
| "description": "Lightweight code editor for React and web apps with syntax highlighting, search/replace, extensions, and enterprise SaaS integration patterns.", | ||
@@ -5,0 +5,0 @@ "authors": [ |
+5
-14
@@ -14,3 +14,3 @@ # Light Code Editor | ||
| ✅ **Modular Architecture** - Extension-based system for maximum flexibility | ||
| ✅ **Syntax Highlighting** - Built-in highlighting for HTML, CSS, JavaScript, TypeScript, JSON, Markdown, Bash/Shell, Python, Go, C/C++, Java, C#, Rust, Ruby, SQL, YAML, XML/SVG, Dockerfile, and PHP | ||
| ✅ **Syntax Highlighting** - Built-in highlighting for HTML, CSS, JavaScript/JSX, TypeScript/TSX, JSON, Markdown, Bash/Shell, Python, Go, C/C++, Java, C#, Rust, Ruby, SQL, YAML, XML/SVG, Vue, EJS, Dockerfile, and PHP | ||
| ✅ **Themes** - Light and dark theme support | ||
@@ -233,3 +233,3 @@ ✅ **Line Numbers** - Optional line number gutter | ||
| #### `SyntaxHighlightingExtension` | ||
| Provides built-in syntax highlighting for `html`, `css`, `javascript` / `js` / `jsx`, `typescript` / `ts` / `tsx`, `json`, `markdown` / `md`, `bash` / `shell` / `sh` / `zsh`, `python` / `py`, `go` / `golang`, `c`, `cpp` / `c++`, `java`, `csharp` / `cs`, `rust` / `rs`, `ruby` / `rb`, `sql`, `yaml` / `yml`, `xml` / `svg`, `dockerfile` / `docker`, and `php`. | ||
| Provides built-in syntax highlighting for `html`, `css`, `javascript` / `js`, `jsx`, `typescript` / `ts`, `tsx`, `json`, `markdown` / `md`, `bash` / `shell` / `sh` / `zsh`, `python` / `py`, `go` / `golang`, `c`, `cpp` / `c++`, `java`, `csharp` / `cs`, `rust` / `rs`, `ruby` / `rb`, `sql`, `yaml` / `yml`, `xml` / `svg`, `vue`, `ejs`, `dockerfile` / `docker`, and `php`. | ||
@@ -380,17 +380,7 @@ ```typescript | ||
| FormattingExtension, | ||
| type Formatter, | ||
| createLightweightFormatter, | ||
| } from '@editora/light-code-editor'; | ||
| const formatter: Formatter = async (context) => { | ||
| if (context.mode === 'selection') { | ||
| return context.input.trim(); | ||
| } | ||
| return context.text | ||
| .replace(/>\s+</g, '>\n<') | ||
| .trim(); | ||
| }; | ||
| const formatting = new FormattingExtension({ | ||
| formatter, | ||
| formatter: createLightweightFormatter(), | ||
| timeoutMs: 3000, | ||
@@ -413,2 +403,3 @@ }); | ||
| - Timeouts and newer formatting runs cancel stale async work so old results do not overwrite newer edits. | ||
| - `createLightweightFormatter()` provides dependency-free formatting for common snippets. It is conservative and safe for HTML, CSS, PHP, Python, Bash, Go, C/C++, Java, C#, Rust, Vue, JSX/TSX, EJS, Dockerfile, and plain text, but it is not a replacement for dedicated formatters like Prettier, Black, gofmt, or php-cs-fixer. | ||
@@ -415,0 +406,0 @@ #### `ContextMenuExtension` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
565357
5.26%30
3.45%9388
7.03%705
-1.26%