Articles
Published · November 18, 2026

Right-to-Left Text in Markdown: Hebrew on iPhone and Mac

Mixed Hebrew and English lines can display out of order in plain text. Here is why it happens and how to fix it on iPhone and Mac.

Also in: Español中文हिन्दी

Markdown has no right-to-left switch: the text and the app that displays it decide the direction, and the first strong character in a paragraph usually sets it. That is why a Hebrew blessing inside an English note can come out with its punctuation on the wrong side. Hanukkah 2026 begins at sundown on Friday, 4 December, and if you keep a Hanukkah planner for all eight nights, you will likely mix both scripts in one file. Here is why that goes wrong, and how to fix it.

Why mixed Hebrew and English text scrambles

Plain text stores characters in the order you typed them. Display order is a separate step, and that is where trouble starts. The Unicode Bidirectional Algorithm works out how left-to-right and right-to-left characters should appear together, and only the display changes: the characters stay in logical order in the file.

The algorithm sorts every character into a type. Hebrew letters are strong right-to-left. Latin letters are strong left-to-right. Most digits are weak. Spaces, most punctuation and symbols are neutral, which means they borrow their direction from the text around them.

The first strong character decides

Each paragraph gets a base direction, and the first strong character normally picks it. HTML's dir="auto" uses the same idea, and MDN notes that it is a heuristic, not language detection: a comment that starts with an English name and continues in Arabic gets a left-to-right base direction.

Here is a line that shows the problem:

Friday: הדלקת נרות at sundown!

The line starts with English, so it is a left-to-right paragraph. The Hebrew words reverse inside it, and the neutral characters around them have to guess a side.

The Markdown sources we read don't describe a direction setting, so don't count on one. Fix the text and the keyboard instead.

Add a Hebrew keyboard on iPhone and Mac

On iPhone, Apple's keyboard guide says to go to Settings > General > Keyboard, tap Keyboards, then Add New Keyboard and choose Hebrew. Adding a keyboard for another language also adds that language to your Preferred Languages list. While typing, touch and hold the Emoji button or the Switch Keyboard key to change keyboards. Our guide to iPhone gestures and external keyboard shortcuts covers more of the typing side, and dictating notes on iPhone is another way to get text in.

On Mac, open System Settings, choose Keyboard, go to Text Input and click Edit. Add an input source for a right-to-left language if you don't have one yet.

Set paragraph direction on Mac

Apple's Mac guide says macOS supports bidirectional text, and the first character you type sets a paragraph's default direction. So starting a line with a Hebrew word often fixes it by itself.

When it doesn't, put the pointer in the paragraph and use a writing direction command, or Control-click and choose Writing Direction. Some apps may not offer these commands. The keyboard shortcuts also need "Enable keyboard shortcuts" turned on for your input source in Keyboard settings.

| Action | Shortcut | |---|---| | Paragraph to right to left | Control-Command-Left Arrow | | Paragraph to left to right | Control-Command-Right Arrow | | Paragraph to default direction | Control-Command-Down Arrow | | Selected text to right to left | Control-Option-Command-Left Arrow | | Selected text to left to right | Control-Option-Command-Right Arrow | | Selected text to default direction | Control-Option-Command-Down Arrow |

Apple's page doesn't cover iPhone, so we won't promise the same shortcuts there.

Where punctuation, numbers and file names go wrong

The W3C's article on inline bidirectional text lists the usual trouble spots: opposite-direction phrases such as URLs, brand names, phone numbers and file names. Things break when the phrase starts or ends with a neutral character, starts with a number, or is followed by a number.

When you can't restructure the sentence, invisible marks give the neutral characters a direction:

  • U+200F is the right-to-left mark, and U+200E is the left-to-right mark. They fix boundaries only.
  • U+2067 (right-to-left isolate), U+2066 (left-to-right isolate) and U+2068 (first strong isolate) wrap a phrase, and each is closed with U+2069.
  • The embedding characters U+202A, U+202B and U+202C don't isolate, and the W3C advises against them.

The W3C says control characters are for inline phrases and that markup is better where it exists. Markdown notes have no such markup, so the marks are the practical tool. One catch: they are real characters in your file. They sync and paste along with the text, but search and diff tools can trip over characters you can't see. Add them only to lines that display wrongly.

A routine for Hebrew notes

  • Start Hebrew paragraphs with a Hebrew word when you can.
  • Keep one language per paragraph, or one language per list item.
  • Put an English name, URL or file name at the end of a Hebrew line, and add a mark if the punctuation jumps.
  • Check the file on both your iPhone and your Mac before you share it.

How Carets fits in

Carets is a native notes and code editor for iPhone, iPad and Mac. Your Hebrew notes stay plain Markdown files, so they remain portable and don't depend on one app. Files, projects and tags keep the holiday planner, the blessings and the shopping list in separate places. Because Carets is built for iOS and Mac, you can start a note on your phone in the evening and finish it on your Mac the next day. Get Carets on the App Store for iPhone, iPad and Mac.

Frequently Asked Questions

Does Markdown have a right-to-left setting?

The Markdown sources we read don't describe one. Direction comes from the text and from the app displaying it: the first strong character in a paragraph decides its base direction. If a paragraph starts with English and continues in Hebrew, expect left-to-right. Putting a Hebrew word first, or adding a right-to-left mark, changes that.

Why does my punctuation jump to the wrong side of a Hebrew sentence?

Punctuation and spaces have no direction of their own, so the bidirectional algorithm assigns one from the surrounding text. At the edge of an opposite-direction phrase, that guess can be wrong. An invisible mark such as U+200F or U+200E next to the punctuation gives it a clear direction.

Are the direction marks stored in my file?

Yes. They are real Unicode characters, just invisible. They survive copy and paste and sync, but they can surprise search or diff tools, so use them only where a line displays wrongly.

How do I type Hebrew on an iPhone?

Add the Hebrew keyboard in Settings > General > Keyboard > Keyboards > Add New Keyboard. Then switch to it while typing by touching and holding the Emoji button or the Switch Keyboard key.