Plugin dev pointers needed: re-formatting links as buttons


#1

Hi,

I’m looking for some high-level guidance on approach to building a link formatting plugin.

The plugin should automatically display links to a particular web resource (matching a given regular expression) as a button.

Essentially, when someone includes a URL in a post matching a specific pattern, like this:

http://mysite.domain/specific/path/

…the post should appear as if they had used the following markdown:

[![Foo](my-button.png)](http://mysite.domain/specific/path)

I’m not sure at what point in the code I should be performing my link identification RegEx and modifying the output.

Should I be doing this through a…

  • Dialect?
  • Linkify rules extension/schema?
  • Markdown-it text replacement?
    (md.core.textPostProcess.ruler)
  • Nokogiri link extraction and modification?

Appreciate if someone could point me in the right direction.

Thanks

Sam


(Mittineague) #2

Hi sjd333 welcome to the forum

If all you want to to do is style certain links, all you need to do can be done with CSS


#3

Oh, fantastic! Thanks for getting back to me. That is a much simpler route to go down, so will go with that. Will report back once I’m done case I can help someone to achieve a similar result.

Best,

Sam