mystx.ext.github_readme_stats.pinned_repo#

GitHub 置顶仓库卡片指令。

提供 GitHubPinnedRepoDirective,将用户名与仓库名渲染为 GitHub Readme Stats 的 pin 卡片。

Example:

.. github-pinned-repo::
   :username: octocat
   :repo: hello-world
   :theme: dark

1.  Classes#

GitHubPinnedRepoDirective

渲染 GitHub 置顶仓库卡片。

2.  Module Contents#

class mystx.ext.github_readme_stats.pinned_repo.GitHubPinnedRepoDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[源代码]#

Bases: mystx.ext.github_readme_stats.base.BaseGitHubCardDirective

渲染 GitHub 置顶仓库卡片。

选项:

  • username(必填):GitHub 用户名;

  • repo(必填):仓库名;

  • theme(可选):主题名称,默认为 default。

  • link(可选):点击卡片跳转的链接地址。

示例参见模块文档的用法。

option_spec[源代码]#

Mapping of option names to validator functions.

run()[源代码]#

根据指令选项构建卡片 URL 并返回 HTML 节点。

Returns:

list[nodes.Node]: 单元素列表,包含原始 HTML <img> 节点。