Przekształć swoje README

Wskaż poleceniu README przez --readme albo przekaż adresy URL kart jako argumenty. Wypisuje każdy adres URL z kartą, w którą się zamienił, wymienia pominięte, a potem wypisuje konfigurację lub zapisuje ją do --output. Na przykład README poniżej zamienia się w konfigurację pod nim.

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

Następnie dodaj workflow z szybkiego startu i zastąp stare adresy URL obrazów wygenerowanymi plikami.

Obsługiwane karty

Usługa URL zawiera Karty
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

Mapowanie opcji

Ich opcja 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

Nazwy motywów są dopasowywane do 43 gotowych motywów, łącznie z aliasami, takimi jak tokyonight, onedark, gruvbox, dark i highcontrast. layout=compact staje się stylem donut-compact, a donut, donut-vertical i pie stają się donut.

Zamienne adresy URL do samodzielnego hostowania

Jeśli uruchamiasz własny serwer kart (profile-graphics serve lub handler profile-graphics/server), możesz zachować stare adresy URL obrazów i zmienić tylko domenę: serwer odpowiada na ścieżki i parametry zapytań github-readme-stats i github-readme-streak-stats z tym samym mapowaniem, którego używa 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)
Ścieżka Karta
/api summary
/api/top-langs langs
/api/pin repo-card
/api/wakatime wakatime
/streak, /?user= streak
Ich parametr 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
  • Nieznane parametry są ignorowane, podobnie jak show_icons, line_height, text_bold, number_precision, size_weight, count_weight i stats_format. Nieprawidłowa wartość dostaje 400 z komunikatem wskazującym parametr.
  • Motyw bez pasującego gotowego motywu wraca do motywu domyślnego; kolory to wartości szesnastkowe z # lub bez, a bg_color przyjmuje też gradient, na przykład 30,e96443,904e95.
  • Karty są rysowane dla GitHuba z tokenem serwera. Zapytanie nigdy nie zmienia tokenu, hosta API, źródła danych ani wyjścia: api_domain nie jest obsługiwane, a /api/wakatime pokazuje konto z WAKATIME_API_KEY serwera.
  • type=json ze streak-stats nie jest obsługiwane; /github/<user>.json zwraca statystyki jako JSON.

Różnice

  • Motyw bez pasującego gotowego motywu jest pomijany, a konfiguracja wraca do natywnego motywu automatycznego.
  • Własne kolory, tytuły i inne opcje tych usług nie są przenoszone; ustaw je przez theme.colors, svg.frame_title i cards.
  • Wygrywa pierwsza znaleziona nazwa użytkownika; bez niej konfiguracja zawiera your-username.
  • Konfiguracja zawsze używa provider: github; zmień to dla GitLaba lub Codeberg.