mkdocs-ai-summary
AI Summary powered by DeepSeek
mkdocs-ai-summary is an MkDocs plugin that generates AI-powered summaries for documentation pages. It offers minimal, mkdocs-material, and real-world demos, and was initially built for a personal blog. Install via pip, then configure mkdocs.yml to use ChatGPT, DeepSeek, or Tongyi Qianwen; ChatGPT and DeepSeek use OpenAI-compatible APIs, while Tongyi uses DashScope, requiring the relevant API key. Optional ai-summary.css supports custom admonition styling with mkdocs-material. Summaries can be set globally or per page via meta tags, with page configuration overriding global settings. Cache entries are keyed by page title and the MD5 of Markdown after ignore_code processing, and prompt/model/endpoint/config changes do not invalidate them. Full details appear in the Chinese and English READMEs.
Demos
Minimal demo(raw mkdocs): AIboy996/mkdocs-ai-summary-minimal-example
Another demo(mkdocs-material theme): AIboy996/mkdocs-ai-summary
Real world demo(my homepage): yangzhang.site
I wrote these codes for my blog site at first. Now it's open for anyone who may need AI to summarize his words.
Installation
You should install the package with pip:
pip install mkdocs-ai-summary[chatgpt]
# this will install `openai` additionally
pip install mkdocs-ai-summary[tongyi]
# this will install `dashscope` additionally
pip install mkdocs-ai-summary[deepseek]
# this will install `openai` additionally
Warning
Supported providers are ChatGPT, DeepSeek, and Tongyi Qianwen. ChatGPT and DeepSeek use OpenAI-compatible APIs; Tongyi uses DashScope.
To use ChatGPT(default), you should set a Environmental Variable for api key:
export OPENAI_API_KEY='sk-xxxxxxx'
To use tongyi ai, you should set a Environmental Variable for api key:
export DASHSCOPE_API_KEY='sk-xxxxxxx'
To use DeepSeek, set DEEPSEEK_API_KEY:
export DEEPSEEK_API_KEY='sk-xxxxxxx'
Info
(this is optional, and iff you are using mkdocs-material theme this can work)
Then you can include the ai-summary.css(optional, this is for the custom ai summary admonition style) in the config file as below.
Configuration
For the full configuration reference, provider defaults, page-level overrides, and cache behavior, see the 中文主 README or English README. The api option accepts chatgpt, deepseek, or tongyi.
ChatGPT summary
Setup mkdocs.yml like this:
site_name: mkdocs-ai-summary
theme:
name: material
plugins:
- ai-summary:
api: "chatgpt"
model: "gpt-3.5-turbo"
ignore_code: true
cache: true
cache_dir: "./"
prompt: "Please help me summarize the following content into an abstract within 200 words: "
- tags
markdown_extensions:
- admonition
- pymdownx.details
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
extra_css:
- ai-summary.css
Then for the page you want an ai-summary, just add a meta tag:
---
include:
- ai-summary
---
# title
hello ai summary.
Tongyi Qianwen summary
or you can use tongyi ai by setting:
plugins:
- ai-summary:
api: "tongyi"
model: "qwen-turbo"
ignore_code: true
cache: true
cache_dir: "./"
prompt: "Please help me summarize the following content into an abstract within 200 words: "
Set up ai-summary for a specific page
You can also setup ai summary for each page separately:
---
include:
- ai-summary
ai-summary-config:
api: "tongyi"
model: "qwen-turbo"
prompt: "帮我把下面的内容总结为200字以内的摘要:"
---
# title
hello ai summary.
all config options are available. Page configuration will override unified configuration.
About Cache
Cache entries are keyed by page title and the MD5 of the Markdown body after ignore_code processing. Prompt, model, endpoint, and other configuration changes do not invalidate a cache entry. See the README for details and cache file locations.
Enjoy it.
SPECIAL THANKS TO
these awsome projects: