hexojs / hexojs/hexo-renderer-markdown-it

支持自定义出现重复标题时的标题 ID 开始计数的数字

Open
#196 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
369
Forks
59
PR merge metrics
No merged PRs in 30d

Description

在出现重复标题时, 意味着标题 ID 也会重复, 但标题重复是正常的, 标题 ID 不能重复. 于是在定义重复标题 ID 开始计数的数字时出现了分歧:

在 VS Code, 由 IntelliSense 提供支持的 Markdown [自动路径补全](https://code.visualstudio.com/docs/languages/markdown#_path-completions)中, 对于出现重复标题的开始计数的数字是 `1`; 但是当前
hexo-renderer-markdown-it 开始计数的数字默认是 `2`.

例如存在如下的 Markdown 源代码:

```
## title
### title
#### title
```

那么 VS Code 可用于自动补全的提示会是:

```
#title
#title-1
#title-2
```

> ![image](https://user-images.githubusercontent.com/62034099/233364278-37601ce8-b9ee-4103-8b84-77ddecbc6583.png)

但是经过 hexo-renderer-markdown-it 渲染后的标题 ID 会是, 不存在 `title-1`:

```
#title
#title-2
#title-3
```

> ![image](https://user-images.githubusercontent.com/62034099/233365395-d9e0e3a6-e6f9-4173-a53a-ac486e04adf2.png)

---

因此, 希望能够支持自定义 anchor 选项中对于重复标题的标题 ID 开始计数的数字.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.