HTML Mark Text Generator
WM-57Wrap the words you want highlighted in ==double equals== and get HTML with the mark element, escaped and ready to paste.
Runs in your browser. Nothing is uploaded.
Text; wrap highlighted parts in ==double equals==. Optional lines: class:, id:, title:
HTML
How to use it
- Type your text and put == on both sides of each part to highlight.
- Optionally add class:, id: or title: lines to put those attributes on every mark.
- Choose whether blocks get a p element and whether line breaks become br.
- Copy the HTML into your page.
What mark is for
The mark element highlights text because it is relevant in the current context. Typical uses are showing the words that matched a search query in a result, or pointing a reader to a phrase in a quoted passage. It is not decoration: for plain visual emphasis use CSS on a span. Browsers draw it with a yellow background and dark text by default, which you can change with a mark rule. Screen readers do not always announce it, so do not rely on the highlight alone to carry meaning.
How the markers work
Put == before and after the words to highlight, as in a ==cursor== lets you step through rows. Only that part becomes a mark element. If the text contains no markers at all, each line is wrapped whole, which is what you want for a single phrase. Markers stay on one line and do not nest. A single equals sign, such as in a formula, is left alone. Everything outside the markers is escaped, so angle brackets and ampersands show as typed.
Attributes and paragraphs
A class line is added to every generated mark, which is handy for a search-hit style. Blocks separated by a blank line become p elements; switch that off to get inline markup only. Control characters are removed from the text. The tool writes only the mark and p tags, so add links or other markup by hand afterwards. Nothing is sent anywhere: the conversion happens in the page.
Questions people ask
What does the HTML mark tag do?
It highlights text that is relevant in context, such as a search term inside a result. Browsers show it with a yellow background by default.
How do I change the highlight colour?
Style it with CSS, for example mark { background: #cfe8ff; color: inherit; }. The tool can add a class line if you want a specific selector.
When should I use mark instead of strong?
strong means the text is important. mark means it is relevant to what the reader is doing right now, such as a matched search word. Choose by meaning, not by looks.
Can I highlight just part of a sentence?
Yes. Put == on both sides of that part. The rest of the sentence stays plain text. You can mark several parts on the same line too, as in ==one== and ==two==, and each part gets its own mark element.
Does mark work for screen readers?
Support is mixed, and many do not announce it by default. If the highlighted meaning matters, say it in the text as well. Add a visible word such as match, or use a visually hidden note, when the highlight carries meaning that listeners need.
About this tool
Writing ==word== around part of a line wraps just that part in a mark element. If the text has no markers at all, every line is wrapped whole. Blocks of text separated by blank lines become p elements. Optional class, id and title lines are added to every mark. Browsers highlight mark in yellow by default, and you can change that with a CSS mark rule. Markers do not nest and cannot span lines. All other text is escaped, so tags you type are shown as text, not interpreted.