Text Editor and Syntax Highlighting

ETWriter provides a browser-based editor for UTF-8 text, source code, and configuration files. When CodeMirror 5 is available, the editor provides syntax highlighting and other developer-oriented features.

Opening the Editor

  1. Select Editor from the mode selector.
  2. Click Open to load an existing file, or begin with the empty editor.
  3. Select a language if needed.
  4. Edit the text.
  5. Enter an output filename.
  6. Click Save.

Editor Features

FeatureDescription
Syntax HighlightingColors recognized syntax according to the language mode
Line NumbersDisplays numbered lines
Line WrappingWraps long lines within the editor
Active-Line HighlightingHighlights the current editing line
Automatic Language DetectionUses file extensions to select syntax modes
Manual Language SelectionAllows the user to choose a language
UTF-8 SavingEncodes text as UTF-8 when saving

ETWriter uses the Darcula CodeMirror theme in the supplied implementation.

Automatic Language Detection

The language selector includes:

Auto (from filename)

When Auto is selected, ETWriter examines the loaded filename extension and chooses an appropriate CodeMirror mode.

Examples:

FilenameDetected Language
app.jsJavaScript
component.tsxTSX
config.jsonJSON
index.htmlHTML
styles.cssCSS
README.mdMarkdown
settings.yamlYAML
main.pyPython
program.goGo
Cargo.tomlTOML

Unrecognized extensions default to plain-text highlighting.

Manual Language Selection

You can override automatic detection using the language selector.

Supported options include:

  • Plain Text
  • JavaScript
  • TypeScript
  • JSX
  • TSX
  • JSON
  • HTML
  • CSS
  • Markdown
  • XML
  • YAML
  • Shell
  • Python
  • Java
  • C/C++
  • Go
  • Rust
  • TOML/INI/Conf

The selected language changes the editor's highlighting mode. It does not translate the file, compile the source code, or change the underlying programming language.

JavaScript Editing

Select JavaScript for .js, .mjs, or .cjs files.

Example:

function greet(name) {
  return `Hello, ${name}!`;
}

console.log(greet("World"));

The editor provides syntax coloration when the JavaScript mode is available.

JSON Editing

Select JSON for structured configuration data.

Example:

{
  "application": "ETWriter",
  "settings": {
    "theme": "darcula",
    "lineNumbers": true
  }
}

JSON syntax highlighting is supported.

ETWriter does not implement a dedicated JSON validation command in its supplied editor code.

HTML and CSS Editing

ETWriter supports HTML and CSS highlighting.

HTML example:

<section class="welcome">
  <h1>Welcome to ETWriter</h1>
</section>

CSS example:

.welcome {
  padding: 2rem;
  color: #16f2c3;
}

Markdown Editing

Markdown files are supported through the Markdown highlighting mode.

Example:

# Project Notes

## Tasks

- Review source code
- Update configuration
- Save changes

Markdown is edited as source text. The supplied application does not provide a separate rendered Markdown preview.

Language Status Badge

ETWriter displays a language badge with a color associated with the selected mode.

For example, JavaScript, Python, and HTML have different badge colors.

The badge is an interface aid, not a syntax validation result.

CodeMirror Fallback

If CodeMirror cannot be loaded, ETWriter falls back to an ordinary text area.

Basic text editing remains possible, but advanced CodeMirror features such as syntax highlighting and line numbers will not be available.

Important Limitations

The supplied text editor is not a full integrated development environment.

It does not provide dedicated implementations of:

  • Code execution
  • Compilation
  • Debugging
  • Project-wide symbol navigation
  • Integrated version control
  • Automatic source formatting

Syntax highlighting is a visual editing feature and does not guarantee that code is valid.

Saving Changes

Enter an output filename, then select Save.

All text is encoded as UTF-8 before being written to the output file or downloaded.

Tip: For configuration files and source code, keep the correct filename extension so ETWriter can select the expected highlighting mode the next time you open the file.


Did this page help you?