Add auto-link functionality, e.g. to create links to bug tracker
It would be really useful if when a message contained text such as "blah blah blah bug 23 blah blah" that the text 'bug 23' was changed into a link to bug 23 in our issue tracker.
This could be handled more generally as a regex replacement that is applied to the message, with the system administrator being able to add multiple such regular expressions. This would allow all kinds of links, e.g. [[wp:Foo]] to link to the Wikipedia article 'Foo'.
The replacement could be applied at the point of save or the point of rendering, but I would recommend point-of-rendering so that (a) these can be retro-actively applied; and (b) that users are able to edit their posts in the form they were originally posted. Oh, and (c) if you find you've ballsed-up your regex for certain edge-cases you don't end up with mangled posts.
TortoiseSVN has a good implementation. So I would suggest a variant on that.
For each replacement, there would be three fields (plus, maybe, some administrative fields e.g. to give the replacement a name):
1) A pattern to match the text that will trigger the linking ability. E.g. a naive implementation might consist of "[Bb]ug\s+\d+" which matches "Bug 5", "bug 1234", etc.
2) A pattern that searches within the previous match to extract link elements. E.g. "(\d+)" would extract the digits "23" from the matched text "bug 23". You could implement it to allow for multiple matches, but in practice restricting to a single field would probably be enough.
3) A URL that is used to create the link. In the URL $1 would be replaced by the matched string ($2, $3, etc. if you allow for multiple matches in step 2). E.g. "http://example.com/bugtracker/$1".
Using the above examples, the string "blah blah bug 23 blah blah" would be matched as follows:
* The first regex matches on "bug 23".
* The second regex matches on "23" within this string.
* The URL is therefore http://example.com/bugtracker/23
* The message output is therefore <a href="http://example.com/bugtracker/23" target="_blank">bug 23</a>
The TortoiseSVN code is clever enough to match multiple bug numbers if you set up an appropriate regex. e.g. it could match "bugs 23, 25 and 27" and turn that into three separate links (in this case the word 'bugs' the comma and the 'and' would not be part of the links).
Note that the above implementation is just a suggestion, based on a very neat and flexible solution that I have used and which works well, but I'm sure there are many other implementation approaches that could be taken.
Hey all! We now have a Beta version of a plugin that supports custom auto-linking.
All feedback is much appreciated as we develop this plugin further.
its sound good but need more explanation about this but it is helpful thanks from https://elkooora.live/
Emma T commented
its sound good but need more explanation about this but it is helpful thanks from https://www.flyundervpn.com
love problem solution commented
Bae Basics commented
great a lot of us taking advantage of this tool thnks https://baebasics.com
review croc commented
is this plugin is for interlinking auto and what you mean by custom auto linking we have to code the thing or what i want to add this on https://www.reviewcroc.com
how you can do this thing manual by coding i want this for my blog https://hazrataliquotesenglish.com
Let me know if you need any help on the plugin you created.
Good platform to ask questions is our community site: http://www.indianblackmagicspecialist.com/online-horoscope-kundali-matching.html
Would love to see you there!
That plugin goes part-way to implementing what is being requested here, but for one crucial element:
> This plugin creates regular expression (regexp) patterns that are
> reformatted into a Markdown link before the message is saved into
> the database.
There are real issues with this happening before being saved, rather than happening before rendering, as it means it is a lossy conversion that cannot be updated to fix e.g. bad configuration or URL changes.
It also means that anyone editing a post will not see what they typed, but some modified version, breaking the principal of least surprise and potentially causing confusion and errors.
It's a potential interim solution, but it doesn't go far enough. Perhaps Mattermost needs an extra hook to allow a pre-render transformation?
Awesome, thank you Luke!
Thanks for shring
Luke: Let us know if you need any help on the plugin you created.
Good platform to ask questions is our community site: https://pre-release.mattermost.com. Would love to see you there!
Awesome, thank you Luke! We have some documentation to help you get started here: https://developers.mattermost.com/extend/plugins/webapp/
I would also recommend joining our Developer Toolkit channel where you can ask questions more easily: https://pre-release.mattermost.com/core/channels/developer-toolkit
I am currently working on a plugin that does just this.
Hi Nev: This could be an excellent plugin. Any interest from the community to help if we prepare some guidance on it?
Could this be solved with a plugin?
Since it just manipulates the frontend.
Zulip has this implemented already.
We need this in mattermost as well!
CUSTOMIZABLE AUTOMATIC LINKIFICATION
Customize Zulip’s markup to automatically link back to your issue tracker or GitHub when you type “#1235” or a commit ID.
Ha Moj Ha