Ionaru / Ionaru/easy-markdown-editor

Display placeholder for all Unicode bidi control characters

Open
#427 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.1k
Forks
363
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
Some Unicode control characters get a placeholder character; some do not. In particular, the bidi control characters are essential for fixing LTR/RTL problems.

**Describe the solution you'd like**
Extend the CodeMirror `specialChars` regex to include the following character ranges:

```
\u2066-\u2069
\u202A-\u202E
```

**Describe alternatives you've considered**
EasyMDE should take a `specialChars` option which would replace the CodeMirror option.

**Additional context**
While hidden/confusable characters are generally a security issue in code, I don't think Markdown has the same problem, as it isn't an executable programming language. (Although it might be argued that code might be copied from a Markdown code block, and its important to see if it there are any hidden/confusable characters in the code to be copied.)

However, when authoring LTR/RTL combined content, being able to see the characters that override the base direction is essential.

I tried this:

```js
let mde = new EasyMDE( ... );
mde.codemirror.specialChars = /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc\u2066-\u2069\u202A-\u202E]/;
```

but it didn't seem to have any effect.

Contributor guide

Open the contributing guide

Research direction

Start at the EasyMDE CodeMirror setup referenced by mde.codemirror and inspect how the specialChars option is configured. Check how CodeMirror renders special characters, then include the requested bidi ranges and verify that those characters receive placeholders while authoring mixed-direction Markdown.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.