Site Management > Site Support / Feedback

Suggestion: Add a "gh" BBCode tag for easy reference to FSO GitHub Issues/PRs

(1/1)

jg18:
It would be handy to have an easy way to insert references to FSO GitHub issues and pull requests. How about a new "gh" tag?

Suggested syntax


--- Code: ---[gh]Issue #3336[/gh]

--- End code ---

would turn into

Issue #3336

and


--- Code: ---[gh]PR #3398[/gh]

--- End code ---

would turn into

PR #3398

If "gh" is confusing, the tag could be "github" instead.

Thoughts?

EatThePath:
I don't know exactly what would be needed to be done to implement this... but I bet I know enough of the relevant languages to figure it out if given the access, and would be willing to take a crack at it if the existing admin pool thinks this is a good idea but not one they're prepared to dive into.

Goober5000:
The forum is written in PHP, and the code is publicly downloadable at simplemachines.org.  Here's how the URL tag is set up:


--- Code: --- array(
'tag' => 'url',
'type' => 'unparsed_content',
'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener noreferrer">$1</a>',
'validate' => function(&$tag, &$data, $disabled)
{
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = '//' . $data;
},
),

--- End code ---

ngld:
Done. I've used a simple regex to find the # number which means that "PR #123" and "PR #123: Some test" work but "PR #123a" doesn't. "Did you look at #123 already?" would work as well. Just make sure that your text contains #<number><some kind of separator like " ", ":", ".", ...> somwhere.

The current tag always links to the FSO repo. I could add [gh=pcs2], [gh=knossos], ... as well if there's interest.

EDIT: I've also added the gh and fsolog tags to the toolbar as well since I keep forgetting them.

jg18:
Sweet! It works great. :D Thanks, ngld! :yes:

Navigation

[0] Message Index

Go to full version