Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix anchor positioning for identical table of contents names #5101

Merged
merged 3 commits into from
Dec 26, 2023

Conversation

LIlGG
Copy link
Member

@LIlGG LIlGG commented Dec 22, 2023

What type of PR is this?

/kind bug
/area editor
/milestone 2.12.x

What this PR does / why we need it:

重写了对默认编辑器标题的 id 生成逻辑。目前将会在对标题进行任意的修改之后,对所有的标题进行 id 计算,用以解决当标题名称具有重复时,生成了相同的 id.

需要注意的是,由于需要对任意标题进行修改之后才会进行生效,因此已经存在重名标题 id 的问题时,需要修改任意的标题使其生效。

How to test it?

在文章内新增多个相同内容的标题,查看是否可以正常跳转。

Which issue(s) this PR fixes:

Fixes #5068

Does this PR introduce a user-facing change?

解决默认编辑器中具有重名标题时,锚点只会跳转至首个的问题。

@f2c-ci-robot f2c-ci-robot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Dec 22, 2023
@f2c-ci-robot f2c-ci-robot bot added this to the 2.12.x milestone Dec 22, 2023
@f2c-ci-robot f2c-ci-robot bot added the area/editor Issues or PRs related to the Editor label Dec 22, 2023
@f2c-ci-robot f2c-ci-robot bot requested review from Aanko and QuentinHsu December 22, 2023 06:40
@LIlGG
Copy link
Member Author

LIlGG commented Dec 22, 2023

/cherrypick release-2.11

@halo-dev-bot
Copy link
Collaborator

@LIlGG: once the present PR merges, I will cherry-pick it on top of release-2.11 in a new PR and assign it to you.

In response to this:

/cherrypick release-2.11

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

codecov bot commented Dec 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cdd5cb4) 55.91% compared to head (3dca6a1) 55.91%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #5101   +/-   ##
=========================================
  Coverage     55.91%   55.91%           
  Complexity     3032     3032           
=========================================
  Files           524      524           
  Lines         17826    17826           
  Branches       1329     1329           
=========================================
  Hits           9968     9968           
  Misses         7309     7309           
  Partials        549      549           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Dec 26, 2023
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

Copy link

f2c-ci-robot bot commented Dec 26, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 26, 2023
@f2c-ci-robot f2c-ci-robot bot merged commit e778992 into halo-dev:main Dec 26, 2023
4 checks passed
@halo-dev-bot
Copy link
Collaborator

@LIlGG: new pull request created: #5113

In response to this:

/cherrypick release-2.11

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

f2c-ci-robot bot pushed a commit that referenced this pull request Dec 26, 2023
…tents names (#5113)

This is an automated cherry-pick of #5101

/assign LIlGG

```release-note
解决默认编辑器中具有重名标题时,锚点只会跳转至首个的问题。
```
@JohnNiang JohnNiang modified the milestones: 2.12.x, 2.12.0 Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/editor Issues or PRs related to the Editor kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

文章目录中存在相同名字的标题,点击只会跳转到第一个
4 participants