Khan / Khan/live-editor

The `escape` character should have it's own syntax highlighting

Open
#494 7 comments 0 reactions 0 assignees View on GitHub
editor idea
Dominant language
JavaScript
Stars
776
Forks
180
PR merge metrics
No merged PRs in 30d

Description

I ran into a user-error when trying to build something on your platform. My codeblock looked like this:

``` js
var Term = function() {
this.components = new Array(arguments.length);
this.totalComponents = arguments.length;

this.divides = [];
for(var i = 0; i < this.totalComponenets; i++) {
this.components[i] = arguments[i];
if (this.components[i] === "/" || this.components[i] === "\") {
this.divides.push(i);
}
}
};
```

Github makes it clear where the problem is, but it took my sleep-deprived brain a little longer. I was escaping the closing quote mark! The fix was simple: escape the escape character to actually compare against a backslash:

``` js
var Term = function() {
this.components = new Array(arguments.length);
this.totalComponents = arguments.length;

this.divides = [];
for(var i = 0; i < this.totalComponenets; i++) {
this.components[i] = arguments[i];
if (this.components[i] === "/" || this.components[i] === "\\") {
this.divides.push(i);
}
}
};
```

It would be awesome if the Khan platform made the `\` symbol more obviously a special character.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue provides JavaScript code examples where a backslash is difficult to distinguish from an escaped quote. Start by locating the live editor's syntax-highlighting entry point, then check how escape characters are rendered and add coverage if the project has relevant tests. Done means the backslash is visibly identified as a special character in the editor.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.