How to slash through text
Slash through letters with Unicode combining overlays or strikethrough markup. Follow the steps, check the marks, and keep the original words intact.
To slash through text in plain text, attach a Unicode combining overlay after each visible character: U+0338 COMBINING LONG SOLIDUS OVERLAY for a diagonal slash, or U+0336 COMBINING LONG STROKE OVERLAY for a horizontal line through the letter. In lightweight markup that implements strikethrough, wrap the span in double tildes. In a rich-text editor, apply the strikethrough font style to the selection. The original letters stay in the string; the mark is extra drawing or an extra code point stacked on each letter.
What slashing through text does
Slashing through text marks wording as crossed out, cancelled, or superseded while keeping that wording available to read. It is a visual annotation of existing characters. The transformation is useful when a revision trail, a voided phrase, or a completed item should remain visible.
Input is a string, file, or selected span. Two output families exist. In plain text, each chosen base character is followed by a combining overlay, so the stored value grows and the glyph is drawn with a stroke or solidus through it. In formatted documents, a strikethrough style is applied to a span: the stored letters can stay unchanged and only painting changes. Combining overlays apply per character (or per grapheme cluster). Editor and markup styles apply per selected span.
Scope that matters for meaning: skip control characters such as newline, carriage return, and tab, or a mark can attach to a line break and scramble layout. Accents already on a letter belong to the same grapheme cluster; the overlay belongs after that whole cluster so one slash sits on the accented letter. Search, sort, and length counts see overlay code points as part of the string, so an overlaid word can miss a query for the unmarked spelling.
How to produce and check the intended result
No named processing tool or engine was supplied for this query, so the steps use documented Unicode overlay code points for plain text, plus replacement syntax that inserts those points, and common strikethrough markup for rendered documents. Treat the snippets below as worked examples of the mapping, and confirm the mark in the destination you will actually use before you overwrite a file.
Prerequisites
- A UTF-8 editor, terminal, or script host. Combining overlays live outside ASCII, and a non-Unicode save will drop or replace them.
- A copy of the source if the next write updates a file in place.
- A chosen mark: U+0338 for a diagonal slash through each letter, or U+0336 for a horizontal stroke. U+0337 COMBINING SHORT SOLIDUS OVERLAY and U+0335 COMBINING SHORT STROKE OVERLAY are shorter variants of the same idea.
- A decision about whitespace: mark only non-whitespace characters when you want word shapes and line breaks left intact.
Plain-text overlays
- Hold the unmarked original in another buffer, or write the result to a new file.
- Iterate the text by Unicode code point so characters outside the Basic Multilingual Plane stay whole.
- After each character you want slashed, insert the overlay immediately. Skip newlines, carriage returns, tabs, and other controls.
- Leave combining marks that already belong to a letter in place, and add a single overlay after that cluster. Stacking extra overlays on an existing mark produces a second stroke on the accent.
- Save the result as UTF-8.
Illustrative example of the mapping, labeled as an example rather than a captured command log:
Before:
Hello world
After, U+0336 after each non-whitespace character:
H̶e̶l̶l̶o̶ w̶o̶r̶l̶d̶
After, U+0338 after each non-whitespace character:
H̸e̸l̸l̸o̸ w̸o̸r̸l̸d̸
A small Python mapping that inserts a solidus overlay and leaves common line-break and tab characters unmarked (example):
SOLIDUS = "\u0338"
STROKE = "\u0336"
def slash_through(text, mark=SOLIDUS):
return "".join(
ch if ch in "\n\r\t" else ch + mark
for ch in text
)
The same idea as a Unicode-aware replacement in JavaScript (example). The u flag treats the pattern as Unicode; \S matches a non-whitespace character, which is then returned with the overlay appended:
const SOLIDUS = "\u0338";
function slashThrough(text) {
return text.replace(/\S/gu, (ch) => ch + SOLIDUS);
}
Replacement syntax in other engines follows the same rule: match one visible character, emit that character plus U+0338 or U+0336. A single s/old/new/ substitution on a whole word only slashes that whole word if new already contains the overlays. Encoding must stay Unicode throughout; a pipeline that recodes to Latin-1 or another narrow set will lose the marks. Newline convention (LF versus CR+LF) is unchanged when those controls are skipped.
Markup and editor styling
When the destination renders markup instead of raw combining characters, wrap the span rather than rewriting each letter. In Markdown flavors that implement strikethrough, double tildes mark the span:
~~Hello world~~
In HTML-like markup, a strikethrough or deletion span is commonly written as <s>Hello world</s> or <del>Hello world</del>. Those forms store the original letters without overlay code points. They read as slashed only after a renderer that honors the syntax. In a word processor or rich-text field, select the span and turn on the strikethrough font effect from the format or font controls; that path usually leaves the stored characters unmarked.
Overlay marks at a glance
| Unicode name | Code point | Effect on a letter |
| COMBINING LONG SOLIDUS OVERLAY | U+0338 | Diagonal slash through the glyph |
| COMBINING SHORT SOLIDUS OVERLAY | U+0337 | Shorter diagonal slash |
| COMBINING LONG STROKE OVERLAY | U+0336 | Horizontal line through the glyph |
| COMBINING SHORT STROKE OVERLAY | U+0335 | Shorter horizontal stroke |
Result check
- The original letters remain readable through the mark. If the letters vanished, the operation deleted content instead of overlaying it.
- A code-point inspector on a slashed letter shows the base character followed by U+0338 or U+0336.
- A search for the unmarked spelling can miss overlaid text. Strip the overlay points, or search for the base letters, when you need a match.
- A dotted circle, a slash sitting beside the letter, or a mark that jumped to the next line means the font, the cluster boundaries, or a control character was handled poorly.
- The saved file is still UTF-8. U+FFFD replacement characters mean the overlay was lost in a bad encoding conversion.
Preservation and recovery
Work on a copy until the check passes. Combining overlays are reversible: remove U+0335, U+0336, U+0337, and U+0338 and the base letters remain. Recovery is that deletion of overlay code points only. If the editor applied a strikethrough style, turning the style off restores the unstruck appearance and leaves the characters as they were. An in-place file write can discard the unmarked original, so keep the backup until the rendered mark and the stored letters both look right.
Rendering of combining overlays varies by font and display engine; this guide does not claim a support matrix. Naive per-code-point mapping over spaces, combining accents, and line breaks produces cluttered or broken layout, so restrict the insertion to the characters whose glyphs should carry the slash.