Closed oeyoews closed 10 months ago
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Mark.js Example</title> <script src="https://cdn.jsdelivr.net/npm/mark.js"></script> <style> .mark { background-color: mark; font-weight: bold; } </style> </head> <body> <div id="content"> This is a simple example of using Mark.js to highlight keywords like JavaScript, HTML, and CSS. </div> <script> document.addEventListener('DOMContentLoaded', function () { var markInstance = new Mark(document.getElementById('content')); markInstance.mark(['JavaScript', 'HTML', 'CSS'], { element: 'span', className: 'mark' }); }); </script> </body> </html>