-
Notifications
You must be signed in to change notification settings - Fork 922
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(markdown): update default anchor permalink function (close #1363) (
#1452) BREAKING CHANGE: the default permalink function of markdown-it-anchor has been changed from `ariaHidden` to `headerLink` for better accessibility, which would be a potential breaking change for theme authors --------- Co-authored-by: Xinyu Liu <[email protected]>
- Loading branch information
Showing
4 changed files
with
51 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# title | ||
|
||
## anchor 1 | ||
|
||
### anchor 1-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
describe('markdown > anchors', () => { | ||
it('should render anchors and navigate correctly', () => { | ||
cy.visit('/markdown/anchors.html') | ||
|
||
cy.get('.e2e-theme-content h1') | ||
.should('have.attr', 'id', 'title') | ||
.should('have.attr', 'tabindex', '-1') | ||
|
||
cy.get('.e2e-theme-content h1 > a') | ||
.should('have.attr', 'class', 'header-anchor') | ||
.should('have.attr', 'href', '#title') | ||
.click() | ||
|
||
cy.location().should((location) => { | ||
expect(location.hash).to.eq('#title') | ||
}) | ||
|
||
cy.get('#anchor-1-1 > a') | ||
.should('have.attr', 'class', 'header-anchor') | ||
.click() | ||
|
||
cy.location().should((location) => { | ||
expect(location.hash).to.eq('#anchor-1-1') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters