Hashtag linking to categories doesn’t always work


(Gaurang Tandon) #1

On the Codecademy site, this link does not work: #Codecademy-Community-Lounge:Codecademy-Platform-Problems-and-Suggestions

But this one is fine: #Codecademy-Community-Lounge (of course doesn’t work here)

The non-functional link to the Problems category has the closing span tag stuck in too soon:

Here is another one that doesn’t work: #Codecademy-Community-Lounge:Feature-Course-Requests

It has the same <span> problem, this time just the “s” is cut off.

Looks like there is a 50 character limit on these.

Seems like a easy bug fix…


Credits to @AlbionsRefuge for the initial draft :slight_smile:


(Sam Saffron) #2

@tgxworld this looks like your bug :slight_smile:


(Gaurang Tandon) #3

I found the problem code here:

This line:

Discourse.Dialect.inlineRegexp({
  start: '#',
  matcher: /^#([\w-:]{1,50})/i,
  spaceOrTagBoundary: true,

The {1, 50} is causing the issue.


(Alan Tan) #4

Thanks for finding out the cause of the bug. We need to expand that limit to 101 since category names are limited to 50 chars.


(Gaurang Tandon) #5

@tgxworld If I may ask, why 101 character limit? :slight_smile: Is it for 50 characters category name+50 characters sub-category name? Then shouldn’t it be 100 char limit?

P.S. I need some help committing code:

I had made this branch name: hashtag_category_linking_fix. I am using GitHub’s Windows client. I do not know why I got the error on the eighth step here (I am following the official guide). I was just trying for fun but that didn’t quite work. Help is appreciated :slight_smile:


(Alan Tan) #6

That’s because a sub category hashtag will include a :. Ah I see your problem… You have a typo in your branch name hastag_category_linking_fix. Note the missing h


(Gaurang Tandon) #7

Lol! Now I don’t know how to rename branches, I will just let it remain that way. Trying to push the code again.


(Alan Tan) #8

Typo in a branch name is fine but in the future, you can rename with

git branch -m <new branch name>


(Gaurang Tandon) #9

After having renamed, now I am getting this:

intl@intl-PC  /f/discourse (hashtag_category_linking_fix)
$ git push mine hashtag_category_linking_fix
Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I will probably try these things some other day. Cmd doesn’t like me…


(Tomas Ibarra) #10

I fixed the problem, made a PR waiting to be merged.


(Tomas Ibarra) #11

Here is the solution, it’s already been merged:

Bug can be closed now. @tgxworld @eviltrout


(Jeff Atwood) #12