question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for extensions

See original GitHub issue

I think it would be nice to add a method to mark.js to support plugins/extensions.

I had a crazy idea - I told you I tend to go overboard on ideas - about being able to highlight links (<a>) based on their url. So if I search for github, it would highlight all links with “github” in their href attribute. Of course this could be extended to highlight any element with matching data-attributes as well. Crazy idea huh?

The current synonyms setting would not work in this case. I tried the filter callback and I found node is only returning text nodes. So there would need to be a change to the API, I think.

I definitely don’t think this should be part of the core plugin, which is why I thought the ability to add plugin/extensions would be cool/interesting/crazy/.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Mottiecommented, Sep 6, 2016

why you’re talking about done and .unmark()

I was thinking that the done callback provided the query value, so you could then add that code snippet to mark the links, but now I see it doesn’t. And if any previous mark elements added would be removed. I guess that data-markjs attribute could be added if you wanted the .unmark() function to clear up the highlights.

May I ask for your timezone?

U.S. central time zone… I live in the land of Oz. Dorothy is my neighbor and I spray Toto with a water hose all the time because he barks too much.

Anyway, now that I think about it, there isn’t really a need for plugin/extension support as pretty much everything can be done with callbacks or outside of mark.js. Thanks for listening and tolerating my ramblings!

0reactions
julmotcommented, Sep 6, 2016

Anyway, now that I think about it, there isn’t really a need for plugin/extension support as pretty much everything can be done with callbacks or outside of mark.js.

I think so too. There was a user that used mark.js to highlight mentions and hashtags using a RegExp, e.g. @mention or #hashtag. He used the a element and added a href attribute on each each callback call. But this is the only use case I see with links here. Just finding elements and not just text parts can be done by native DOM methods.

Thanks for listening and tolerating my ramblings!

Anyway, I appreciate you’re getting involved in mark.js and finding further use cases is helpful! So gladly again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add apps and extensions - Chromebook Help - Google Support
Add an app or extension. Open the Chrome Web Store. In the left column, click Apps or Extensions. Browse or search for what...
Read more >
How to Add Extensions to Chrome or Remove Them
1. Open Chrome and then navigate to the Chrome web store. · 2. Search or browse for the extension you want to add...
Read more >
How to Add Extensions in Google Chrome - wikiHow
1. Open Google Chrome on your computer. It's a red, green, yellow, and blue circular app. 2. Go to the Google Chrome Store....
Read more >
How to Use Chrome Extensions on Android Mobile Browsers
This guide shows you how to install Chrome extensions on Android using Kiwi Browser. How to Add Chrome Extensions on Android Using Kiwi...
Read more >
How to Install Chrome Extensions on Android - Alphr
1. Open the Android "Kiwi Browser." 2. Tap on the "vertical ellipsis" (three vertical dots) menu icon. 3. Select "Extensions."
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found