Langsung ke konten
Skillpedia
PDF, Word & slide31k ยท #9289

brain-pdf

Fungsinya

Skill ini membuat PDF yang rapi dari sebuah halaman di brain Anda. Skill ini berguna untuk membagikan atau mengarsipkan dokumen yang sudah selesai.

Kapan dipakai

  • โœ“Saat Anda ingin membagikan halaman brain sebagai PDF lewat email atau chat.
  • โœ“Ketika Anda ingin laporan atau briefing dalam format yang rapi dan siap cetak.
  • โœ“Saat Anda ingin menyimpan halaman panjang dalam file yang mudah dibawa.

Link skill

https://github.com/garrytan/gbrain/blob/master/plugin/skills/brain-pdf/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/garrytan/gbrain/blob/master/plugin/skills/brain-pdf/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œUbah halaman strategi saya di brain menjadi PDF yang rapi dengan nomor halaman, supaya bisa saya kirim lewat email.โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent menghapus detail tersembunyi di bagian atas halaman dan membersihkan simbol khusus. Setelah itu agent memakai alat PDF terpisah untuk merender halaman dengan header dan nomor halaman.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

brain-pdf โ€” Render a Brain Page to Publication-Quality PDF

Convention: see conventions/quality.md for output rules. The PDF is a rendering โ€” never the primary artifact. If a PDF exists, the source brain page exists behind it.

The rule

The brain page is ALWAYS the source of truth. The PDF is a rendering of it, never a standalone artifact. If a PDF exists somewhere, the brain page must exist behind it.

What this does

Renders a brain page (markdown with frontmatter) into a publication-quality PDF using the gstack make-pdf binary. Output is suitable for:

  • Sharing a personalized book mirror via email or Telegram
  • Delivering a strategic-reading playbook as a clean read
  • Producing a briefing or report with running headers and page numbers
  • Archiving a long-form essay in a portable format

Prerequisite: gstack make-pdf

This skill depends on the gstack make-pdf binary at:

$HOME/.claude/skills/gstack/make-pdf/dist/pdf

The user must have gstack co-installed. If absent, the skill cannot run. A future v0.26+ may bundle a fallback PDF renderer; for v0.25.1 gstack is a soft prereq.

Verify it exists before invoking:

P="$HOME/.claude/skills/gstack/make-pdf/dist/pdf"
[ -x "$P" ] || { echo "make-pdf not installed; install gstack" >&2; exit 1; }

Workflow

1. RESOLVE  โ†’ Confirm the brain page exists (gbrain get <slug>).
2. STRIP    โ†’ Remove YAML frontmatter โ€” the renderer would otherwise
              dump it as a full page of raw metadata text.
3. RENDER   โ†’ Invoke make-pdf with sane defaults (no --cover, no --toc).
4. DELIVER  โ†’ Hand the PDF to the requester via the agent's preferred
              channel (do not use raw `MEDIA:` tags on Telegram โ€”
              they fail silently).

Invocation

SLUG="path/to/page"
P="$HOME/.claude/skills/gstack/make-pdf/dist/pdf"

# 1. Confirm the page exists.
gbrain get "$SLUG" > /dev/null || { echo "Page $SLUG not found" >&2; exit 1; }

# 2. Get the raw markdown. Two paths: read from the brain repo (if user
#    syncs locally) OR ask gbrain for the body via the API.
BRAIN_DIR=$(gbrain config get sync.repo_path 2>/dev/null || echo)
if [ -n "$BRAIN_DIR" ] && [ -f "$BRAIN_DIR/$SLUG.md" ]; then
  RAW="$BRAIN_DIR/$SLUG.md"
else
  RAW=$(mktemp /tmp/brain-page-XXXXXX.md)
  gbrain get "$SLUG" > "$RAW"   # prints the page as markdown with frontmatter
fi

# 3. Strip the leading YAML frontmatter block only: line 1 '---' through
#    the next '---'. A later '---' (a horizontal rule) and a page without
#    frontmatter are kept as written. Plain awk, so it behaves the same with
#    BSD (macOS) and GNU tools. Stop if nothing is left to render.
CLEAN=$(mktemp /tmp/brain-page-clean-XXXXXX.md)
awk 'NR==1 && /^---[[:space:]]*$/ {f=1; next} f==1 && /^---[[:space:]]*$/ {f=2; next} f!=1' "$RAW" > "$CLEAN"
[ -s "$CLEAN" ] || { echo "brain-pdf: nothing to render for $SLUG after removing frontmatter" >&2; exit 1; }

# 4. Render. NO --cover, NO --toc by default โ€” they look corporate
#    and waste space. Add them only if explicitly requested.
OUT="/tmp/$(basename "$SLUG").pdf"
CONTAINER=1 "$P" generate "$CLEAN" "$OUT"

echo "Rendered: $OUT"

CONTAINER=1 is mandatory in containerized environments โ€” it tells Playwright to skip Chromium sandboxing. Harmless on bare-metal.

Common patterns

# Default โ€” clean PDF, no cover, no TOC
brain-pdf <slug>

# Draft watermark for in-progress work
CONTAINER=1 "$P" generate --watermark DRAFT "$CLEAN" "$OUT"

# Optional cover + TOC if the user explicitly asks
CONTAINER=1 "$P" generate --cover --toc "$CLEAN" "$OUT"

# Custom title + author override (otherwise pulled from frontmatter)
CONTAINER=1 "$P" generate --title "Custom Title" --author "Custom Author" "$CLEAN" "$OUT"

Defaults: NO cover, NO TOC

These flags are off by default because they look corporate and waste space on most personal-knowledge content. Only add them when the user explicitly asks for "formal" output (e.g., something they're sending to a board or printing as a deliverable).

Font requirements

The renderer needs:

  • fonts-liberation (Helvetica/Arial substitute)
  • fonts-noto-cjk (Chinese/Japanese/Korean characters)
  • Minimum body font size: 10pt (page chrome 9pt)
  • Body text: 11pt

If running in an environment without these fonts, install them via the host's package manager (apt install fonts-liberation fonts-noto-cjk on Debian/Ubuntu containers).

Delivery

After rendering,

Pertanyaan umum

Apakah PDF menggantikan halaman di brain saya?

Tidak. Halaman brain tetap yang asli, dan PDF hanya salinannya.

Apakah saya perlu perangkat lunak tambahan?

Ya. Langkah PDF memerlukan alat terpisah bernama make-pdf yang harus dipasang.

Apakah PDF menampilkan detail pribadi?

Metadata tersembunyi di bagian atas halaman dihapus sebelum PDF dibuat.

Detail

Deskripsi asli dari pembuat

Generate a publication-quality PDF from any brain page via the gstack make-pdf binary. Strips YAML frontmatter, sanitizes emoji, applies running headers and page numbers. Brain page is always the source of truth; PDF is a rendering.

repo: garrytan/gbrain

Popularitas

Bintang GitHub
31k
Peringkat
#9289
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa