luminjs to highlight text in html page
If you have been looking for some utility which could assist in highlighting the text or paragraph on the web or HTML pages, here is a new Javascript kid in the town. It is called as LuminJS.
LuminJS is a Javascript library which could help in achieving some of the following objectives:
Here is the Github page for LuminJS.
Execute the following command:
npm install --save lumin
Let’s say there is an HTML div element like following:
<body> <div class="demo"> <div class="title">This is Demo App for LuminJS</div> Hello World! How are you doing? </div> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cscript%20src%3D%22.%2Flumin.min.js%22%3E%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="<script>" title="<script>" /> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cscript%3E%0A%20%20%20%20const%20demo%20%3D%20document.querySelector('.demo')%3B%0A%20%20%20%20const%20luminator%20%3D%20lumin(demo)%3B%0A%20%20%20%20luminator.start(5000)%3B%0A%20%20%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="<script>" title="<script>" /> </body>
In order to Highlight above div element and its child nodes, pay attention to the code used for highlighting:
const demo = document.querySelector('.demo'); const luminator = lumin(demo); luminator.start(5000);
In this post, you learned about how to use LuminJS to highlight text or paragraphs on the web page.
Did you find this article useful? Do you have any questions or suggestions about this article? Leave a comment and ask your questions and I shall do my best to address your queries.
Last updated: 25th Jan, 2025 Have you ever wondered how to seamlessly integrate the vast…
Hey there! As I venture into building agentic MEAN apps with LangChain.js, I wanted to…
Software-as-a-Service (SaaS) providers have long relied on traditional chatbot solutions like AWS Lex and Google…
Retrieval-Augmented Generation (RAG) is an innovative generative AI method that combines retrieval-based search with large…
The combination of Retrieval-Augmented Generation (RAG) and powerful language models enables the development of sophisticated…
Have you ever wondered how to use OpenAI APIs to create custom chatbots? With advancements…