# Mentioning Categories instead of Groups?

**URL:** https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697
**Category:** Feature
**Tags:** markdown-it-review
**Created:** [2014 年4 月 11 日 20:10 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697 "2014-04-11T20:10:55Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### 作者： ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### 发布日期： [2016 年1 月 4 日 07:09 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/21 "2016-01-04T07:09:02Z")

</div>

Wouldn’t it be more like topics? eg.

`https://meta.discourse.org/c/:slug/:id`

---

<div class="post-metadata">

### 作者： ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### 发布日期： [2016 年1 月 4 日 07:24 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/22 "2016-01-04T07:24:09Z")

</div>

I’m guessing the tricky part is the fact that there is a separate path parameter for subcategories.

So you currently have these two routes:

```
1. https://meta.discourse.org/c/:category_slug
2. https://meta.discourse.org/c/:category_slug/:subcategory_slug

```

If you append `:id` to the end of each you end up with:

```
A. https://meta.discourse.org/c/:category_slug/:id
B. https://meta.discourse.org/c/:category_slug/:subcategory_slug/:id

```

But now `A` looks a lot like `2`, so this would break backward compatibility unless you add some heuristics in the `A` route to say something like “if :id is not a number, try matching it to a subcategory instead.”

That’s the best option I’ve come up with so far (with my limited knowledge of how the Rails and/or Ember routers work).

---

<div class="post-metadata">

### 作者： ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### 发布日期： [2016 年1 月 4 日 12:28 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/23 "2016-01-04T12:28:29Z")

</div>

Ok I just added support for links which uses the category ID instead but at the same time still keeping the slug in the link.

[https://github.com/discourse/discourse/commit/d523dd320809d93f01705de9ea72a5852ddc42f2](https://github.com/discourse/discourse/commit/d523dd320809d93f01705de9ea72a5852ddc42f2)

`#howto` —\> `meta.discourse.org/c/4-howto`  
`#tips-and-tricks` —\> `meta.discourse.org/c/how-to/tips-and-tricks/5`

---

<div class="post-metadata">

### 作者： ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### 发布日期： [2016 年1 月 4 日 14:23 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/24 "2016-01-04T14:23:33Z")

</div>

Just thought of a possible improvement for the sake of consistency. Instead of:

```
#howto ---> meta.discourse.org/c/4-howto

```

How about:

```
#howto ---> meta.discourse.org/c/howto/none/4

```

Or:

```
#howto ---> meta.discourse.org/c/howto/all/4

```

---

<div class="post-metadata">

### 作者： ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### 发布日期： [2016 年1 月 4 日 14:38 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/25 "2016-01-04T14:38:57Z")

</div>

`#howto` ----\> `meta.discourse.org/c/howto/4` is possible but we already have code that handles `4-howto` which I think works just as well.

---

<div class="post-metadata">

### 作者： ![mr8](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@mr8](https://meta.discourse.org/u/mr8)
#### 发布日期： [2016 年1 月 9 日 20:47 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/26 "2016-01-09T20:47:24Z")

</div>

Just noticed this great new feature, but I’m not sure if `#` is exactly the right way to mention a category…

Maybe we could use `/category_name` or `/c/category_name` and keep the hashtag reserved for tags or some other future #hashtag feature?

---

<div class="post-metadata">

### 作者： ![Tom\_Newsom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tom_newsom/32/115981_2.png) [@Tom\_Newsom](https://meta.discourse.org/u/Tom_Newsom)
#### 发布日期： [2016 年1 月 9 日 21:01 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/27 "2016-01-09T21:01:09Z")

</div>

The other way it breaks down is when you try and say

#Support is the most popular category

---

<div class="post-metadata">

### 作者： ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### 发布日期： [2016 年1 月 9 日 21:09 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/28 "2016-01-09T21:09:11Z")

</div>

You need to add a space before the # if it is at the start of a new line, otherwise it is treated like a header.

Edit: Clarity

---

<div class="post-metadata">

### 作者： ![mr8](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@mr8](https://meta.discourse.org/u/mr8)
#### 发布日期： [2016 年1 月 9 日 21:14 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/29 "2016-01-09T21:14:35Z")

</div>

I do LOVE the idea of allowing users to subscribe and get notified to a #hashtag, but also don’t want a bunch of extra categories that don’t really need their own category.

I think something similar to the current discourse-tagging plugin might work better - admin can create a list of useable hashtags and select which groups/trust\_levels can use them.

Plus it would also be great to be able to browse all the #hashtags like we can with tags (e.g. /tags/tag\_name), but display the individual posts instead of just the topics.

---

<div class="post-metadata">

### 作者： ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### 发布日期： [2016 年1 月 9 日 21:49 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/30 "2016-01-09T21:49:56Z")

</div>

@mr8，我没看懂你的帖子。这里并没有创建新的分类。这只是在允许通过 # 来提及现有分类，例如 #contribute:feature。

---

<div class="post-metadata">

### 作者： ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### 发布日期： [2016 年1 月 10 日 00:04 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/31 "2016-01-10T00:04:53Z")

</div>

I, for one, am very much liking the current implementation.

That said, I think it could be expanded to allow tag mentions too though… how many places will have namespace collisions with category names and tag names? A different styling could be applied to differentiate whether the link were going to a tag vs. a category.

---

<div class="post-metadata">

### 作者： ![Yuun](https://avatars.discourse-cdn.com/v4/letter/y/977dab/32.png) [@Yuun](https://meta.discourse.org/u/Yuun)
#### 发布日期： [2016 年1 月 10 日 03:09 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/32 "2016-01-10T03:09:51Z")

</div>

> [@jomaxro](#):
>
> You need to add a space before the #, otherwise I’d is treated like a header.

Mm, I don’t know what I’d replace it with but I’m not crazy about the shared syntax. Or rather that the category-mention syntax is technically space+hashtag and not just hashtag, just feels unusually clunky.

I guess it’s a minor stumbling block overall though, I like the feature otherwise. 🙂

---

<div class="post-metadata">

### 作者： ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### 发布日期： [2016 年1 月 10 日 04:00 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/33 "2016-01-10T04:00:49Z")

</div>

I have no idea what you are talking about. It is not space plus hashtag. Just like other forms of autocompletion, it does not work in the middle of words, e.g.

Hey@yuun  
That’s funny:)

Nobody expects those to work, does not mean “space plus”.

---

<div class="post-metadata">

### 作者： ![Yuun](https://avatars.discourse-cdn.com/v4/letter/y/977dab/32.png) [@Yuun](https://meta.discourse.org/u/Yuun)
#### 发布日期： [2016 年1 月 10 日 04:28 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/34 "2016-01-10T04:28:38Z")

</div>

Referring to the case mentioned above with header syntax - category mentions don’t work at the start of a line, while other forms of autocomplete do.

e.g.:

@codinghorror: this mention works fine  
#howto: this doesn’t  
#howto: because it needs a space

```plaintext

@codinghorror: this mention works fine
#howto: this doesn't
 #howto: because it needs a space

```

Space+hashtag was probably a clumsy way of putting it, this is all I’m really referring to here - that it conflicts with the header syntax. It’s an edge case, I guess? I think the most natural use of the category-mention isn’t really at the start of a line, but there it is.

---

<div class="post-metadata">

### 作者： ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### 发布日期： [2016 年1 月 10 日 04:30 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/35 "2016-01-10T04:30:03Z")

</div>

I follow but I am not sure this is a solvable problem ☹ … until we move to the new CommonMark engine.

---

<div class="post-metadata">

### 作者： ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### 发布日期： [2016 年1 月 10 日 04:32 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/36 "2016-01-10T04:32:54Z")

</div>

Already reported this “bug”…@tgxworld said it was not a bug.

> [@Unable to mention category as first text on line](https://meta.discourse.org/t/unable-to-mention-category-as-first-text-on-line/37458):
>
> Continuing the discussion from [Mentioning Categories instead of Groups?](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/16): Summary: Unable to mention a category when the hashtag is the first text on a line. Steps to reproduce: Create topic or post Add category preceeded by hashtag as first text on a line Expected Results: Editor offers to autocomplete category name and create mention Actual Results: Level 1 header is created Notes: Understand that this conflicts with Markdown spec, so not sure how this could be solved. Attachments: …

---

<div class="post-metadata">

### 作者： ![Yuun](https://avatars.discourse-cdn.com/v4/letter/y/977dab/32.png) [@Yuun](https://meta.discourse.org/u/Yuun)
#### 发布日期： [2016 年1 月 10 日 04:34 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/37 "2016-01-10T04:34:32Z")

</div>

Ah apologies I didn’t catch that. If the header syntax is changing at some point then there isn’t a conflict (or well, not a permanent one).

Sorry for the mix-up. 🙂

---

<div class="post-metadata">

### 作者： ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### 发布日期： [2016 年1 月 10 日 05:16 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/38 "2016-01-10T05:16:31Z")

</div>

Yeah, I find myself wanting to see the category’s current color chip / badge next to the link.

e.g. #howto should display as ![](https://global.discourse-cdn.com/meta/original/3X/5/4/54c940f3ff1bfc515ead472294ec218cc1a445af.png) , not ![](https://global.discourse-cdn.com/meta/original/3X/2/9/29520feaffd3b517492b199d947aafeb67fde88e.png)

Probably best done as a decoratePost() trigger, with #category getting a class on the link that the decorator selects on.

---

<div class="post-metadata">

### 作者： ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### 发布日期： [2016 年1 月 10 日 06:57 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/39 "2016-01-10T06:57:01Z")

</div>

Isn’t it solved once the [CommonMark spec](http://talk.commonmark.org/t/issues-to-resolve-before-1-0-release/1287) is finalized and adopted?

> Should space be required after # in ATX headers? (MUST)  
> (Leaving this as it already is - spaces are required.)

---

<div class="post-metadata">

### 作者： ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### 发布日期： [2016 年1 月 10 日 06:58 UTC](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697/40 "2016-01-10T06:58:59Z")

</div>

Yes, I added a markdown-it-review tag there so we can sort it out when we make the move

[上一页](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697.md?page=1)

[下一页](https://meta.discourse.org/t/mentioning-categories-instead-of-groups/14697.md?page=3)
