Makefile

Makefileコードスクリーンショット生成

Makefileのスニペットを、Macから離れることなく共有したくなる画像に。

Makefiles are all whitespace semantics, which is exactly the thing that breaks when someone pastes them into a chat window.

Codeshotは貼り付けたコードからMakefileを判別するので、言語の選び間違いは起きません。付属する30種類のうち3つのテーマで同じスニペットを、アプリ自身のスタイルシートで表示しています。

THEME ?= xcode
SCALE ?= 2

.PHONY: shots
shots: $(patsubst src/%.swift,out/%.png,$(wildcard src/*.swift))

out/%.png: src/%.swift
	@mkdir -p out
	codeshot export $< --theme $(THEME) --scale $(SCALE) --out $@
Edge · ダーク
THEME ?= xcode
SCALE ?= 2

.PHONY: shots
shots: $(patsubst src/%.swift,out/%.png,$(wildcard src/*.swift))

out/%.png: src/%.swift
	@mkdir -p out
	codeshot export $< --theme $(THEME) --scale $(SCALE) --out $@
GitHub · ダーク
THEME ?= xcode
SCALE ?= 2

.PHONY: shots
shots: $(patsubst src/%.swift,out/%.png,$(wildcard src/*.swift))

out/%.png: src/%.swift
	@mkdir -p out
	codeshot export $< --theme $(THEME) --scale $(SCALE) --out $@
Tokyo Night · ダーク

Makefileに合うテーマ選び

Recipes must be indented with tabs, and an image is the only way to share one without a well-meaning editor converting them to spaces.

サイズを正しく決める

画像サイズを内容に合わせるか、比率で固定します(1:1、4:3、3:2、16:9、9:16、2:3、3:4)。そのうえで1×・2×・3×から選んで書き出せば、Retinaディスプレイでも鮮明なままです。Cでクリップボードに直接コピー、またはSで保存できます。

30種類のテーマを見比べるか、全体の流れをご覧ください。

Makefileと、ほかの59言語のために

すべてMac上で動作します。コードが外に出ることはありません。

macOS版をダウンロード