LoginSignup
2
3

More than 5 years have passed since last update.

Let's Chat で特定文字列を別のサイトにリンクする

Last updated at Posted at 2016-12-28

Let's Chat のメッセージ中、 @matobaa#slug と書くと名前やRoomへのリンクになります。これ、たとえば rfc:2882 と書いたら rfc-editor.org にあるRFC2822のページにジャンプできたりしたら便利になりますよね。

Let's Chat ではそのための仕組みが準備されていました。

テンプレートを書けます

extra/replacements/local.yml に以下のように書くことで実現できます:

- regex: \brfc:(\d{1,6})
  template: <a href="https://www.rfc-editor.org/rfc/rfc$1.txt" target="_blank">rfc:$1</a>
- regex: \bth:([\w:]+)\b
  template: <a href="https://trac-hacks.org/intertrac/$1" target="_blank">th:$1</a>

これで ITSのチケットと連携したり、コミットログと紐づけたり、InterTrac のようなことを実現できますね!!

fileスキーマもね

IE11とChromeで、file:スキーマのリンクが使えるようにしよう。

- regex: \bfile:(.*)
  template: <a href="file:$1" onclick="javascript:this.href=decodeURI(this.href); return true;" target="_blank">file:$1</a>

Chromeの場合、そのままではfileリンクは開けないですが、起動時オプションで --allow-file-access-from-files を追加してやれば、file:リンクも開けるようになります。便利!!

Safari、Firefoxは使っていないのでわかりません。だれか試してもらえるとうれしい。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3