47
29

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Github — PullRequest / Issue / コメントでコードを引用・埋め込みする

Last updated at Posted at 2018-07-29

引用とハイライト

( PullRequest の差分などではなく ) コードページで、左側の数字をクリックしてハイライトする。
Shift + クリックで範囲選択が出来る。

image.png

ページのURL例:
https://github.com/YumaInaura/study/blob/master/ansible/inventories/different_ports_on_same_host.txt#L3-L7

パーマリンクをコピー

この状態のままで操作ボタンから「Copy permalink」を選ぶ。

image.png

こんなURLがクリップボードに入る。

この例ではブランチ指定のページからパーマリンクを取得したが、コピーされるのはコミットハッシュが含まれるURLであることが分かる。

PullRequest や Issue や コメント欄にURLを貼り付ける

コードが展開される。

image.png

対応していないもの

  • Wikiには対応していない。
  • Gistでは対応していない。

その他

  • URLから行数指定 ( #L3-L7 ) を消すとコードが展開されない
  • URLの行数指定が元コードの行数を超えると展開されない ( 例 #L3-L9999 )
  • 「ブランチ指定のURL」を貼り付けても展開されない
    • 何故なら仮にブランチ指定が出来ても、コードの状態は更新され得るし、正しい引用にならないからだと理解した

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

47
29
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
47
29

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?