แปลง README ของคุณ

ชี้คำสั่งไปที่ README ด้วย --readme หรือส่ง URL การ์ดเป็นอาร์กิวเมนต์ คำสั่งจะพิมพ์แต่ละ URL พร้อมการ์ดที่แปลงได้และระบุ URL ที่ข้ามไป แล้วพิมพ์การตั้งค่าหรือเขียนลง --output ตัวอย่างเช่น README ด้านล่างจะกลายเป็นการตั้งค่าที่ตามมา

shell
npx profile-graphics migrate --readme README.md --output profile-graphics.yml
npx profile-graphics migrate "https://github-readme-stats.vercel.app/api?username=octocat"
README.md
![Stats](https://github-readme-stats.vercel.app/api?username=octocat&theme=tokyonight&hide_border=true)
![Languages](https://github-readme-stats.vercel.app/api/top-langs?username=octocat&layout=compact&langs_count=8)
![Streak](https://streak-stats.demolab.com?user=octocat&theme=tokyonight)
![Trophies](https://github-profile-trophy.vercel.app/?username=octocat&column=4&row=2)
profile-graphics.yml
# yaml-language-server: $schema=https://unpkg.com/profile-graphics/profile-graphics.schema.json
provider:
  type: github
  user: octocat
charts:
  - summary
  - langs
  - streak
  - trophy
theme:
  preset: tokyo-night
svg:
  frame: none
cards:
  langs:
    style: donut-compact
    count: 8
  trophy:
    columns: 4
    max: 8

จากนั้นเพิ่มเวิร์กโฟลว์จากคู่มือเริ่มต้นฉบับย่อ และแทนที่ URL รูปภาพเดิมด้วยไฟล์ที่สร้างขึ้น

การ์ดที่รองรับ

บริการ URL มีคำว่า การ์ด
github-readme-stats /api summary
github-readme-stats /api/top-langs langs
github-readme-stats /api/wakatime coding-languages
github-readme-streak-stats streak-stats streak
github-profile-trophy github-profile-trophy trophy
github-readme-activity-graph activity-graph activity
github-profile-summary-cards profile-details, productive-time, stats, repos-per-language, most-commit-language profile-details, productive-time, summary, langs

การจับคู่ตัวเลือก

ตัวเลือกเดิม profile-graphics
username, user provider.user
theme theme.preset
hide_border=true svg.frame: none
locale calendar.locale
layout cards.langs.style
langs_count cards.langs.count
hide cards.langs.exclude
column, row cards.trophy.columns, cards.trophy.max
days cards.activity.days

ชื่อธีมจับคู่กับธีมสำเร็จรูป 43 แบบ รวมถึงชื่อแฝงอย่าง tokyonight, onedark, gruvbox, dark และ highcontrast layout=compact กลายเป็นสไตล์ donut-compact และ donut, donut-vertical และ pie กลายเป็น donut

URL ที่ใช้แทนกันได้สำหรับการโฮสต์เอง

หากคุณรันเซิร์ฟเวอร์การ์ดเอง (profile-graphics serve หรือแฮนด์เลอร์ profile-graphics/server) คุณเก็บ URL รูปภาพเดิมไว้และเปลี่ยนแค่โดเมนได้: เซิร์ฟเวอร์ตอบพาธและพารามิเตอร์ query ของ github-readme-stats และ github-readme-streak-stats ด้วยการจับคู่แบบเดียวกับที่ migrate ใช้

README.md
![Stats](https://cards.example.com/api?username=octocat&show_icons=true&theme=radical)
![Languages](https://cards.example.com/api/top-langs?username=octocat&layout=compact)
![Streak](https://cards.example.com/?user=octocat&theme=dark)
พาธ การ์ด
/api summary
/api/top-langs langs
/api/pin repo-card
/api/wakatime wakatime
/streak, /?user= streak
พารามิเตอร์เดิม profile-graphics
username, user provider.user
hide, show cards.summary.metrics
hide_rank, rank_icon cards.summary.show_rank, rank_style
include_all_commits provider.commits_scope: all
count_private provider.count_private
commits_year calendar.year
number_format, short_numbers svg.number_format
custom_title, hide_title cards.<card>.title, hide_title
card_width, card_height cards.<card>.width, height
hide_border, border_radius svg.frame: none, svg.frame_radius
disable_animations svg.animation: none
theme, locale theme.preset, calendar.locale
title_color, icon_color theme.colors.chart.accent, accent2
text_color, bg_color, border_color theme.colors.text, background, border
layout, langs_count, hide cards.langs.style, count, exclude
exclude_repo provider.exclude_repos
repo, show_owner, description_lines_count cards.repo_card.repo, show_owner, description_lines
layout, langs_count, display_format cards.wakatime.layout, limit, display_format
hide, range, hide_progress cards.wakatime.hide, range, layout: list
mode, exclude_days, date_format cards.streak.mode, exclude_days, date_format
hide_total_contributions, hide_current_streak, hide_longest_streak cards.streak.show
type output.format
background, border theme.colors.background, border
ring, fire, currStreakNum, sideNums, currStreakLabel, sideLabels, dates, stroke cards.streak.colors
  • พารามิเตอร์ที่ไม่รู้จักจะถูกละเว้น รวมถึง show_icons, line_height, text_bold, number_precision, size_weight, count_weight และ stats_format ค่าที่ไม่ถูกต้องจะได้ 400 พร้อมข้อความที่ระบุชื่อพารามิเตอร์
  • ธีมที่ไม่มีธีมสำเร็จรูปตรงกันจะกลับไปใช้ธีมเริ่มต้น สีเป็นค่าฐานสิบหกที่มีหรือไม่มี # ก็ได้ และ bg_color รับไล่สี เช่น 30,e96443,904e95 ได้ด้วย
  • การ์ดวาดสำหรับ GitHub ด้วยโทเค็นของเซิร์ฟเวอร์ query ไม่เปลี่ยนโทเค็น โฮสต์ API แหล่งข้อมูล หรือเอาต์พุตเลย: ไม่รองรับ api_domain และ /api/wakatime แสดงบัญชีของ WAKATIME_API_KEY ของเซิร์ฟเวอร์
  • ไม่รองรับ type=json ของ streak-stats /github/<user>.json คืนสถิติเป็น JSON

ความแตกต่าง

  • ธีมที่ไม่มีธีมสำเร็จรูปตรงกันจะถูกตัดออก และการตั้งค่ากลับไปใช้ธีมอัตโนมัติแบบเนทีฟ
  • สีที่กำหนดเอง หัวข้อ และตัวเลือกอื่นของบริการเหล่านั้นไม่ถูกย้ายมา ให้ตั้งด้วย theme.colors, svg.frame_title และ cards
  • ใช้ชื่อผู้ใช้แรกที่พบ หากไม่มี การตั้งค่าจะเขียนว่า your-username
  • การตั้งค่าใช้ provider: github เสมอ ให้เปลี่ยนสำหรับ GitLab หรือ Codeberg