oeyoews / tiddlywiki-starter-kit

📦 使用 TiddlyWiki5 搭建的本地优先笔记软件
https://tiddlywiki-starter-kit.vercel.app/docs
MIT License
47 stars 18 forks source link

markjs #166

Closed oeyoews closed 10 months ago

oeyoews commented 1 year 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>