An efficient and customizable HTML content formatter by updating all occurrences of provided text with predefined formats or fully custom HTML markups. Extremely simple to rapidly highlight, bold, italicize, underline, hyperlink, or delete specific texts from any given webpage with adaptable options. Written in vanilla JS with high compatibility.
Highlight all occurrences of "text" on the webpage:
htmHighlightAll(document.body, 'text')
Highlight all occurrences of "text" under a specific HTML element element
:
htmHighlightAll(element, 'text')
Use custom options as an optional last parameter to select accepted child HTML elements:
htmHighlightAll(document.body, 'text', {
//Disallow all <p> elements and elements with "example" class
blacklist: ['p', '.example']
})
Predefined formatters for the basic uses include:
htmHighlightAll(element, 'text')
htmBoldAll(element, 'text')
htmItalicizeAll(element, 'text')
htmUnderlineAll(element, 'text')
htmStrikethroughAll(element, 'text')
htmLinkAll(element, 'text', 'www.example.com')
htmHeadingAll(element, 'text', 1)
htmRemoveAll(element, 'text')
Format text in a custom manner, where every {0}
in the provided format is replaced by the provided text:
htmCustomizeAll(element, 'text', '<b>{0}</b>(<i>auto replaced by <u>html-text-marker</u></i>)')
Original | htmHighlightAll(document.body, 'HTML') |
---|---|
![]() |
![]() |
This project is under the MIT License.