How to disable @ linking within code tag
When using code or pre tags, @ should not create a link (@JasonBarnabe
). How do I disable this?
If there's no way to do this, can someone at least point me to the code that does this or even the name of this feature? Searching for "@ or at" isn't giving me much, obviously.
Best Answer
-
peregrine MVP
turns off mentions everywhere.
$Configuration['Garden']['Format']['Mentions'] = FALSE;
in class.format.php
also you could possibly write your own GetMentions formatter and override. the method in functions.general.php
function GetMentions($String) {
you would have to muck around with things to make it work within discussion, but not when surrounded with code or pre tags.
@JasonBarnabe didn't say:
@JasonBarnabe didn't say: <?php // testing mentions format on this forum echo "@JasonBarnabe"; @include minion
as an aside:
they appear to not have the issue on this forum. or it is either editor based or fixed in vanilla non-self hosted code.
fixes and changes don't seem to percolate to vanilla 2.1 as fast as the changes in vanilla master.
not many if any commits or changes to 2.1 since release.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
7
Answers
you know the drill or should.
what version of vanilla? what editor?
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Vanilla 2.1. I haven't changed the editor so... default?
turns off mentions everywhere.
$Configuration['Garden']['Format']['Mentions'] = FALSE;
in class.format.php
also you could possibly write your own GetMentions formatter and override. the method in functions.general.php
function GetMentions($String) {
you would have to muck around with things to make it work within discussion, but not when surrounded with code or pre tags.
@JasonBarnabe didn't say:
as an aside:
they appear to not have the issue on this forum. or it is either editor based or fixed in vanilla non-self hosted code.
fixes and changes don't seem to percolate to vanilla 2.1 as fast as the changes in vanilla master.
not many if any commits or changes to 2.1 since release.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
as an aside another feature using hashtags (a # in front of a word as long as it not first character on line, which automarks words with a #hashtags (or e.g. #markdown and clicking sends you to search.
$Configuration['Garden']['Format']['Hashtags'] = TRUE;
$Configuration['Garden']['Format']['Hashtags'] = FALSE;
idiosyncracies with hashtags
firstcharacter - is a # therefore it uses #markdown instead of #hashtag
#firstcharacter is a # therefore it uses #markdown instead of #hashtag
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thanks for the info. Sounds like I'll have to muck around. I'll share the solution if I come up with one.
This forum has the same problem, it's just your inclusion of " immediately before the @ that prevented it.
you might have to look in js as well
I haven't tried geshi plugin - maybe you would have better luck (but maybe not).
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I see that @include as a link...
so do i
It won't be for the faint hearted because you have to back reference to see if @ is within a pre or code tag.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
it might be simpler to change if you want to exclude certain @mentions altogether.
e.g. you could exclude @include and any other @ related to code and let usernames evaluate as is.
or you could may change the preg_replace to also search for <code or <pre. and >pre or >code closing tags.seems like alot of trouble for the benefit.
or maybe validate against against an existing username in the database before changing to an anchor.
lines around 1162 in Mentions routine in class.format.php
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.