mystx.ext.github_readme_stats.top_langs#

GitHub 最常用语言(Top Languages)卡片指令。

GitHubTopLangsDirective 使用 GitHub Readme Stats 服务生成语言占比卡片, 支持 layoutthemelangs_count 等选项。

1.  Classes#

GitHubTopLangsDirective

渲染 GitHub Top Languages 卡片。

2.  Module Contents#

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

Bases: mystx.ext.github_readme_stats.base.BaseGitHubCardDirective

渲染 GitHub Top Languages 卡片。

选项:

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

  • layout (可选):布局样式,默认为 compact

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

  • langs_count (可选):展示语言数量,默认为 6

Example:

.. github-top-langs::
    :username: octocat
    :layout: compact
    :theme: dark
    :langs_count: 8
option_spec[源代码]#

Mapping of option names to validator functions.

run()[源代码]#

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

Returns:

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