This example covers the most basic usage of brevity.js. The process is actually very simple
abbr
tag,
simply register the abbreviation and expanded text for it in the abbreviations array
brevity()
function and watch the magic happen
To see it in action, check out the code below. For simplicity, abbr
tags have been highlighted, like this. Hover over an abbr
tag to see the expanded text.
1
2
<p>HTML and CSS are two core technologies for web development.</p>
<p>Notice that brevity.js is case sensitive, so this html isn't converted to an abbr tag.</p>
1
2
3
4
5
6
// sample JS
var abbrs = [
{ abbr: 'HTML', title: 'Hypertext Markup Language' },
{ abbr: 'CSS', title: 'Cascading Style Sheets' },
];
brevity(abbrs);
HTML and CSS are two core technologies for web development.
Notice that brevity.js is case sensitive, so this html isn't converted to an abbr tag.