Small SEO Tools

How to Keep Markdown Punctuation Literal in a Caption

A caption can contain brackets or asterisks that you want readers to see as ordinary text. Pasting it into Markdown source may turn those characters into formatting instructions. Escape the punctuation once, then compare the rendered caption with the saved original.

This procedure is for one plain, unindented caption on a single line. Keep that selection separate from surrounding Markdown structure.

Check which characters the preview interprets

Use this original caption as a small test.

Label [beta](notes.md) and *draft*.

In a CommonMark preview, beta becomes a link and draft gains emphasis. The brackets, parentheses and asterisks served as markup. Our intended caption includes those characters visibly.

CommonMark allows ASCII punctuation to be escaped with a preceding backslash. The backslash changes how the punctuation is interpreted in the source. See the CommonMark backslash escape rules.

Add an escape before each ASCII punctuation character

Open Find and Replace Text and paste the original caption into Your text. Enable Use regular expression and Replace all. Leave Match case and Whole word only off.

Paste this pattern directly into Find, using single backslashes and no surrounding slashes or flags.

([\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E])

The four ranges cover ASCII punctuation, including brackets, asterisks and the backslash itself. Set Replace with to one backslash followed by the group token.

\$1

In this tool, the backslash stays literal while $1 inserts the captured punctuation. See the MDN numbered replacement reference.

Click Replace. Expect eight replacements, 35 characters before and 43 after.

Label \[beta\]\(notes\.md\) and \*draft\*\.

Compare the rendered caption with the original

Copy the result into the caption’s Markdown source field and open the destination preview. The displayed text should match the first sample exactly, including [beta](notes.md) and the asterisks around draft. Confirm that all words use ordinary text styling and that the link notation remains visible.

Check an original backslash too if your caption has one. For example, Path C:\Notes\[draft]_1 should retain every displayed backslash, bracket and underscore after rendering. Starting from the raw caption lets the same search escape each of those characters.

Keep the source and destination steps distinct

Apply the operation once to the saved plain caption. Applying it again to the escaped output makes the earlier backslashes part of the text displayed to readers.

Use the renderer and settings for the destination where the caption will appear. Keep blocks, indentation and existing Markdown outside this procedure’s selection. Our draft comparison workflow can help check the source change, followed by a review of the actual rendered caption.