Skip to content

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.

License

Notifications You must be signed in to change notification settings

Fei-Sheng-Wu/html-text-marker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html-text-marker

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.

Quick Start

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>)')

Preview

Original htmHighlightAll(document.body, 'HTML')
Original Webpage Formatted Webpage

License

This project is under the MIT License.

About

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.

Topics

Resources

License

Stars

Watchers

Forks