facebook / facebook/lexical

Feature: Show non-printing characters

Open
#8,592 11 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 16h
Merged PRs (30d)
61

Description

## Description

Inspired from https://github.com/facebook/lexical/pull/8519

Now that a generalized DOMSlot has been added to lexical and a powerful example of `VisibleLineBreakExtension` is available in the playground, it makes sense to expand its scope and implement a feature to display non-printing characters. This mode can be enabled in Google Docs and Word via a menu or keyboard shortcut, and certain whitespace characters will become visible. These mainly include:
- Line break `↵` (Shift + Enter)
- Paragraph mark `¶` (Enter)
- Space `·`
- Tab `→`

How it looks in Docs and Word
Image Image

In this mode, it is also useful to display ZWSP and WJ, which can be helpful for Asian languages but are also used in typography for other languages. The characters NBSP and SHY are also commonly used in typography, although they are no longer displayed in popular text editors

## Impact

This is a particularly useful feature for visually distinguishing line breaks from blank paragraphs. Displaying the other characters is necessary for professional typography, when precise control over word breaks is required.

The most likely solution would be to create an extension in the playground and a button in the interface, since styling the characters requires CSS, which cannot be universal across all user editors

Contributor guide

Open the contributing guide

Research direction

Start by reading the generalized DOMSlot and the VisibleLineBreakExtension example in the playground. Define the toggle and interface entry point, then verify that enabled mode visibly distinguishes line breaks, paragraph marks, spaces, tabs, ZWSP, WJ, NBSP, and SHY without imposing styling on other editors.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.